-
Notifications
You must be signed in to change notification settings - Fork 949
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
feature: add rm flag in pouch run command #1125
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1125 +/- ##
==========================================
+ Coverage 15.56% 15.61% +0.04%
==========================================
Files 172 172
Lines 9744 9752 +8
==========================================
+ Hits 1517 1523 +6
Misses 8119 8119
- Partials 108 110 +2
|
@@ -52,6 +52,8 @@ func (rc *RunCommand) addFlags() { | |||
flagSet.BoolVarP(&rc.attach, "attach", "a", false, "Attach container's STDOUT and STDERR") | |||
flagSet.BoolVarP(&rc.stdin, "interactive", "i", false, "Attach container's STDIN") | |||
flagSet.BoolVarP(&rc.detach, "detach", "d", false, "Run container in background and print container ID") | |||
flagSet.BoolVar(&rc.rm, "rm", false, "Automatically remove the container after it exits") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after it has exited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think exits is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on the side of exits
.
cli/run.go
Outdated
|
||
if rc.rm { | ||
if err := apiClient.ContainerRemove(ctx, containerName, true); err != nil { | ||
return fmt.Errorf("failed to stop container %s: %v", containerName, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/stop/remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has updated.
Signed-off-by: Ace-Tang <[email protected]>
|
||
if rc.rm { | ||
if err := apiClient.ContainerRemove(ctx, containerName, true); err != nil { | ||
return fmt.Errorf("failed to remove container %s: %v", containerName, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If error happens at this point, shall we return an exit code of non-zero?
With the change, we still return exit code of 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it a error happend here, this behaviour will get a error message, and of course, it should not be exit of 0, it will get exit code of 1 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I misunderstand your point.
Signed-off-by: Ace-Tang [email protected]
Ⅰ. Describe what this PR did
add rm flag in pouch run command
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews