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

Allow "SIG" prefix on signal names in docker kill ("SIGKILL", etc) #4947

Merged
merged 1 commit into from Apr 1, 2014

Conversation

tianon
Copy link
Member

@tianon tianon commented Apr 1, 2014

This way, we can use both docker kill -s INT some_container and docker kill -s SIGINT some_container and both will do nice things for us. :)

@crosbymichael
Copy link
Contributor

@tianon travis failed

@tianon
Copy link
Member Author

tianon commented Apr 1, 2014

hahahaha, gofmt :)

Thanks, will update.

This way, we can use both `docker kill -s INT some_container` and `docker kill -s SIGINT some_container` and both will do nice things for us. :)

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
@tianon
Copy link
Member Author

tianon commented Apr 1, 2014

Fixed. :)

@@ -144,6 +144,10 @@ func (srv *Server) ContainerKill(job *engine.Job) engine.Status {
if err != nil {
// The signal is not a number, treat it as a string
sig = uint64(signal.SignalMap[job.Args[1]])
if sig == 0 && strings.HasPrefix(job.Args[1], "SIG") {
// If signal is prefixed with SIG, try with it stripped (ie, "SIGKILL", etc)
sig = uint64(signal.SignalMap[job.Args[1][3:]])
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather use strings.TrimPrefix

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this. we already rely on strings.HadPrefix() so we know that we can safely do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just always use strings.TrimPrefix and not worry about the if?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we could :)

@creack
Copy link
Contributor

creack commented Apr 1, 2014

LGTM. WIth or without the changes :)

@crosbymichael
Copy link
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Apr 1, 2014
Allow "SIG" prefix on signal names in `docker kill` ("SIGKILL", etc)
@crosbymichael crosbymichael merged commit 7ab66fa into moby:master Apr 1, 2014
@tianon tianon deleted the sig branch April 1, 2014 19:30
@tianon
Copy link
Member Author

tianon commented Apr 1, 2014

Hah, couldn't even wait for me to fix it? :)

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.

None yet

3 participants