-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
by onsijoe:
What does 'go version' print? go version go1.2.1 darwin/amd64 What steps reproduce the problem? Here's a complete program that exhibits the problem (because it involves exec, it doesn't manifest in the playground): package main import ( "fmt" "os/exec" "syscall" ) func main() { cmd := exec.Command("sleep", "1000000") cmd.Start() done := make(chan struct{}) go func() { err := cmd.Wait() exitStatus := cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() fmt.Println("Error:", err) fmt.Println("Status:", exitStatus) close(done) }() cmd.Process.Kill() <-done } What happened? The output is Error: signal: killed Status: -1 What should have happened instead? Instead, I (believe) I should have seen: Error: signal: killed Status: 137 Please provide any additional information below. Looking at ExitStatus here (http://golang.org/src/pkg/syscall/syscall_linux.go?s=4510:4546#L180) I see that -1 implies the process has not exited. But it actually has (I checked with `ps`)! Is this a bug, or desired behavior? When I run `sleep 1000000` in a shell and then send said process the KILL signal I get an exit code of 137 which is consistent with http://www.tldp.org/LDP/abs/html/exitcodes.html