diff options
| author | Ian Lance Taylor <iant@golang.org> | 2016-01-01 15:44:12 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2016-01-05 18:00:33 +0000 |
| commit | 2c67c8c3038ec7dddecb6c1b29f0610f3262134d (patch) | |
| tree | 41d176bdbe05d0e922717efc872d4fee0c035bc5 /src/runtime/testdata/testprog | |
| parent | 81b35117d9e0b99a5894d65c8c419541a48c87dd (diff) | |
| download | go-2c67c8c3038ec7dddecb6c1b29f0610f3262134d.tar.xz | |
runtime: fix exit status when killed by signal
Previously, when a program died because of a SIGHUP, SIGINT, or SIGTERM
signal it would exit with status 2. This CL fixes the runtime to exit
with a status indicating that the program was killed by a signal.
Change-Id: Ic2982a2562857edfdccaf68856e0e4df532af136
Reviewed-on: https://go-review.googlesource.com/18156
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/testdata/testprog')
| -rw-r--r-- | src/runtime/testdata/testprog/signal.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprog/signal.go b/src/runtime/testdata/testprog/signal.go new file mode 100644 index 0000000000..ac2d3e8f6c --- /dev/null +++ b/src/runtime/testdata/testprog/signal.go @@ -0,0 +1,17 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !windows,!plan9,!nacl + +package main + +import "syscall" + +func init() { + register("SignalExitStatus", SignalExitStatus) +} + +func SignalExitStatus() { + syscall.Kill(syscall.Getpid(), syscall.SIGTERM) +} |
