New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: wrong Unix error code from panic. #24284

Open
robpike opened this Issue Mar 6, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@robpike
Contributor

robpike commented Mar 6, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version devel +baf3eb1625 Tue Mar 6 01:11:26 2018 +0000 darwin/amd64

% cat p.go
package main

func main() {
	panic(3)
}
% ./p
panic: 3

goroutine 1 [running]:
main.main()
	/Users/r/p.go:4 +0x39
% echo $?
2
% 

Exit code 2 traditionally means 'incorrect arguments', as in flag.Usage.

Panic should be something like 127 or 255 on Unix.

Reported by darren.e.grant@gmail.com on nuts.

@cachvico

This comment has been minimized.

cachvico commented Mar 7, 2018

or simply 1 meaning 'general error' ?

(http://tldp.org/LDP/abs/html/exitcodes.html)

@robpike

This comment has been minimized.

Contributor

robpike commented Mar 7, 2018

As has been pointed out in the mail thread, it might be best to leave this alone and say that the error that triggered this is in a program that takes exit code 2 as 'success'. That is certainly nonstandard.

@cachvico

This comment has been minimized.

cachvico commented Mar 7, 2018

Sure, although a note in the language spec might avoid some similar confusion in the future..

I'll open an issue with Supervisor (http://supervisord.org/)

@andybons andybons added the NeedsFix label Mar 7, 2018

@andybons andybons added this to the Go1.11 milestone Mar 7, 2018

@andybons

This comment has been minimized.

Member

andybons commented Mar 7, 2018

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Jul 10, 2018

@cachvico

This comment has been minimized.

cachvico commented Sep 28, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment