Default to killing process on exit

Also adds support for capitalization variants of "no" to not kill
process.
This commit is contained in:
Seth W. Klein
2015-05-07 23:00:46 -04:00
parent 31658f37dc
commit b5c3ee4012

View File

@ -132,13 +132,13 @@ func handleExit(client service.Client, t *Term) (error, int) {
} }
} }
answer, err := t.line.Prompt("Would you like to kill the process? [y/N] ") answer, err := t.line.Prompt("Would you like to kill the process? [Y/n] ")
if err != nil { if err != nil {
return io.EOF, 2 return io.EOF, 2
} }
answer = strings.ToLower(strings.TrimSpace(answer)) answer = strings.ToLower(strings.TrimSpace(answer))
kill := (answer == "y") kill := (answer != "n" && answer != "no")
err = client.Detach(kill) err = client.Detach(kill)
if err != nil { if err != nil {
return err, 1 return err, 1