Todo:golang Linux Process exit description
Golang using the Os.exit (code) process to exit causes the current program to exit and return the given status code. Traditionally, code codes of zero indicate a successful exit, and a non-0 error exits.
Syscall. Exit can invoke the exit of the operating system for different platforms.
The code value is 0-255, and when code is not 0 o'clock, the OS. Exit (code) will return, corresponding to the worth Status code
Exit Status 128
When code is 0, it exits normally. The code value can be customized to use the appropriate business scenario for the purpose. The value of code is cycled from a multiple of 0 to 255, such as a natural number of 256, when the process exits, the 0;256-511== code value is 0-255, the negative number is the same, 256 to -1== "0-255."
Exit code is the use of the situation, under the use of Linux most vividly
0 Command completed successfully
1 Common Unknown errors
2 Misuse of SHELL commands
126 command failed to execute
127 no Command found
128 Invalid Exit parameters
+X uses Linux signal x for fatal errors.
130 commands terminated with CTRL-C
255 exit status outside the specification
echo $? is the exit code that outputs the last command, and we see that 0,126,127 is what we expected. This is the use of the exit code under Linux, and our own software can also be self-defined.
Wxgzh:ludong86
Todo:golang Linux Process exit description