aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_init.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-11-22 14:57:39 +0100
committerSverker Eriksson <[email protected]>2016-11-22 14:57:39 +0100
commit0e2bde208e45bb24ae3d9fcd3db94b93882ecaec (patch)
treea6334828227fda954756453474429335aca89cd9 /erts/emulator/beam/erl_init.c
parent9563cd5b296fe589c8abe357710fbb79bc766d09 (diff)
parentb62020124b3294be021d0d62073ba34cda1ae742 (diff)
downloadotp-0e2bde208e45bb24ae3d9fcd3db94b93882ecaec.tar.gz
otp-0e2bde208e45bb24ae3d9fcd3db94b93882ecaec.tar.bz2
otp-0e2bde208e45bb24ae3d9fcd3db94b93882ecaec.zip
Merge branch 'maint'
Diffstat (limited to 'erts/emulator/beam/erl_init.c')
-rw-r--r--erts/emulator/beam/erl_init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index b299ac8d64..165c440f71 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -2372,6 +2372,8 @@ system_cleanup(int flush_async)
erts_exit_flush_async();
}
+static int erts_exit_code;
+
static __decl_noreturn void __noreturn
erts_exit_vv(int n, int flush_async, char *fmt, va_list args1, va_list args2)
{
@@ -2383,12 +2385,21 @@ erts_exit_vv(int n, int flush_async, char *fmt, va_list args1, va_list args2)
if (fmt != NULL && *fmt != '\0')
erl_error(fmt, args2); /* Print error message. */
- /* Produce an Erlang core dump if error */
+ erts_exit_code = n;
+
+ /* Produce an Erlang crash dump if error */
if (((n == ERTS_ERROR_EXIT && erts_no_crash_dump == 0) || n == ERTS_DUMP_EXIT)
&& erts_initialized) {
erl_crash_dump_v((char*) NULL, 0, fmt, args1);
}
+ erts_exit_epilogue();
+}
+
+__decl_noreturn void __noreturn erts_exit_epilogue(void)
+{
+ int n = erts_exit_code;
+
sys_tty_reset(n);
if (n == ERTS_INTR_EXIT)