Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Error and cleanup function for CreateRunnableCmd failures #135

Merged
merged 5 commits into from
Nov 24, 2021

Conversation

denopink
Copy link
Contributor

PR for #119

Based on the conv in #119, we want to delete the output dir of sudo create runnable for any failure that occurs in CreateRunnableCmd.

Replication steps:

subo create runnable foobar --lang somethingnotsupported

CreateRunnableErrors Error will also act as a cleanup function for these failures. atm, it's only deleting the output dir.

Ideally, cobra.Command would have a error callback feature when RunE fails... maybe we'll get one for Xmas. spf13/cobra#914

Off topic, I wish cobra.Command had a error callback for each of their run E functions (RunE, PreRunE, PostRunE, PersistentPreRunE, PersistentPostRunE). They have a callback for when flag parsing fails. I'll create an issue ticket requesting this if it doesn't already exist.

…Cmd failures

Based on the conv in suborbital#119,  we want to delete the output dir of `sudo create runnable` for any failure that occurs in `CreateRunnableCmd`.

`CreateRunnableError`s `Error` will also act as a cleanup function for these failures. atm, it's only deleting the output dir.

Ideally, cobra.Command would have a error callback feature... maybe we'll get one for Xmas. spf13/cobra#914
@denopink denopink changed the title Add a new Error and cleanup function for build command CreateRunnable… New Error and cleanup function for CreateRunnableCmd failures Nov 24, 2021
Copy link
Contributor

@danielledeleo danielledeleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions. Let me know if you have any questions.

subo/command/create_runnable.go Outdated Show resolved Hide resolved
subo/command/create_runnable.go Outdated Show resolved Hide resolved
subo/command/create_runnable.go Outdated Show resolved Hide resolved
Copy link
Contributor

@danielledeleo danielledeleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@danielledeleo
Copy link
Contributor

Closes #119

Copy link
Contributor

@cohix cohix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@cohix cohix merged commit bbe98ce into suborbital:main Nov 24, 2021
@denopink denopink deleted the denopink/failure-dir-creation branch November 25, 2021 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subo 'create' command still makes a directory if it fails to find a template
3 participants