From 2c67c8c3038ec7dddecb6c1b29f0610f3262134d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 1 Jan 2016 15:44:12 -0800 Subject: 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 Run-TryBot: Ian Lance Taylor --- src/runtime/testdata/testprog/signal.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/runtime/testdata/testprog/signal.go (limited to 'src/runtime/testdata') 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) +} -- cgit v1.3-5-g9baa