1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
[;1m halt()[0m
Equivalent to calling [;;4mhalt(0, [])[0m.
For example:
> halt().
os_prompt%
[;1m halt(HaltType)[0m
Equivalent to calling [;;4mhalt(HaltType, [])[0m.
For example:
> halt(17).
os_prompt% echo $?
17
os_prompt%
[;1m halt/2[0m
[;;4mSince[0m:
OTP R15B01
Halt the runtime system.
• halt(Status :: non_neg_integer(), Options :: halt_options())
Halt the runtime system with status code [;;4mStatus[0m.
[;;4mNote[0m
On many platforms, the OS supports only status codes
0-255. A too large status code is truncated by clearing
the high bits.
Currently the following options are valid:
○ [;;4m{flush, EnableFlushing}[0m - If [;;4mEnableFlushing[0m equals [;;4m[0m
[;;4mtrue[0m, which also is the default behavior, the runtime
system will perform the following operations before
terminating:
◼ Flush all outstanding output.
◼ Send all Erlang ports exit signals and wait for
them to exit.
◼ Wait for all async threads to complete all
outstanding async jobs.
◼ Call all installed NIF on halt callbacks.
◼ Wait for all ongoing NIF calls with the delay
halt setting enabled to return.
◼ Call all installed [;;4matexit[0m/[;;4mon_exit[0m callbacks.
If [;;4mEnableFlushing[0m equals [;;4mfalse[0m, the runtime system
will terminate immediately without performing any of
the above listed operations.
[;;4mChange[0m
Runtime systems prior to OTP 26.0 called all
installed [;;4matexit[0m/[;;4mon_exit[0m callbacks also when [;;4m[0m
[;;4mflush[0m was disabled, but as of OTP 26.0 this is no
longer the case.
○ [;;4m{flush_timeout, Timeout :: 0..2147483647 | infinity}[0m -
Sets a limit on the time allowed for flushing prior to
termination of the runtime system. [;;4mTimeout[0m is in
milliseconds. The default value is determined by the
the [;;4merl[0m [;;4m+zhft <Timeout>[0m command line flag.
If flushing has been ongoing for [;;4mTimeout[0m
milliseconds, flushing operations will be interrupted
and the runtime system will immediately be terminated
with the exit code [;;4m255[0m. If flushing is not enabled,
the timeout will have no effect on the system.
See also the [;;4merl[0m [;;4m+zhft <Timeout>[0m command line
flag. Note that the shortest timeout set by the
command line flag and the [;;4mflush_timeout[0m option will
be the actual timeout value in effect.
Since: OTP 27.0
• halt(Abort :: abort, Options :: halt_options())
Halt the Erlang runtime system by aborting and produce a
core dump if core dumping has been enabled in the
environment that the runtime system is executing in.
[;;4mNote[0m
The [;;4m{flush, boolean()}[0m option will be ignored, and
flushing will be disabled.
• halt(CrashDumpSlogan :: string(), Options :: halt_options())
Halt the Erlang runtime system and generate an Erlang crash
dump. The string [;;4mCrashDumpSlogan[0m will be used as slogan in
the Erlang crash dump created. The slogan will be trunkated
if [;;4mCrashDumpSlogan[0m is longer than 1023 characters.
[;;4mNote[0m
The [;;4m{flush, boolean()}[0m option will be ignored, and
flushing will be disabled.
[;;4mChange[0m
Behavior changes compared to earlier versions:
○ Before OTP 24.2, the slogan was truncated if [;;4m[0m
[;;4mCrashDumpSlogan[0m was longer than 200 characters.
Now it will be truncated if longer than 1023
characters.
○ Before OTP 20.1, only code points in the range
0-255 were accepted in the slogan. Now any Unicode
string is valid.
|