aboutsummaryrefslogtreecommitdiff
path: root/src/os/proc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/proc.go')
-rw-r--r--src/os/proc.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/os/proc.go b/src/os/proc.go
index 7364d631f2..cbd5a6aad9 100644
--- a/src/os/proc.go
+++ b/src/os/proc.go
@@ -7,6 +7,7 @@
package os
import (
+ "internal/testlog"
"runtime"
"syscall"
)
@@ -60,6 +61,13 @@ func Getgroups() ([]int, error) {
// For portability, the status code should be in the range [0, 125].
func Exit(code int) {
if code == 0 {
+ if testlog.PanicOnExit0() {
+ // We were told to panic on calls to os.Exit(0).
+ // This is used to fail tests that make an early
+ // unexpected call to os.Exit(0).
+ panic("unexpected call to os.Exit(0) during test")
+ }
+
// Give race detector a chance to fail the program.
// Racy programs do not have the right to finish successfully.
runtime_beforeExit()