According to the manual of erlang http://erlang.org/doc/man/escript.html:
If the main/1 function in the script returns successfully,the exit status for the script is 0. If an exception is generated during execution, a short message is printed and the script terminates with exit status 127.
To return your own non-zero exit code, call halt(ExitCode), for example:
halt(1).
but, I called halt(1)
to return the exit status 1 to caller, the caller cannot get the exit code, and commands below the $ERTS_DIR/bin/escript myscript
in my shell script is not running. by the way, if myscript exit normally, the exit code 0 is received, and commands below the $ERTS_DIR/bin/escript myscript
is running. what can I do for this?