diff options
author | Lukas Larsson <[email protected]> | 2016-06-03 11:43:47 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-06-03 11:43:47 +0200 |
commit | 85996c92853e90cb233a1405b1c8c7bb1b8ca54e (patch) | |
tree | 31a39b2f82adee6f34cb83d8cc66e786006b65ae | |
parent | 45a4a46333b1e8e6f66ba923deaf947a67ae7737 (diff) | |
download | otp-85996c92853e90cb233a1405b1c8c7bb1b8ca54e.tar.gz otp-85996c92853e90cb233a1405b1c8c7bb1b8ca54e.tar.bz2 otp-85996c92853e90cb233a1405b1c8c7bb1b8ca54e.zip |
erts: make HEART_NO_KILL have to be set to TRUE
-rw-r--r-- | erts/etc/common/heart.c | 13 | ||||
-rw-r--r-- | lib/kernel/doc/src/heart.xml | 5 | ||||
-rw-r--r-- | lib/kernel/test/heart_SUITE.erl | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/erts/etc/common/heart.c b/erts/etc/common/heart.c index b6fbfd075c..0dd82cc036 100644 --- a/erts/etc/common/heart.c +++ b/erts/etc/common/heart.c @@ -526,8 +526,10 @@ static void kill_old_erlang(void){ HANDLE erlh; DWORD exit_code; + char* envvar = NULL; - if (is_env_set(HEART_NO_KILL)) + envvar = get_env(HEART_NO_KILL); + if (!envvar || strcmp(envvar, "TRUE") == 0) return; if(heart_beat_kill_pid != 0){ @@ -561,13 +563,14 @@ kill_old_erlang(void){ pid_t pid; int i, res; int sig = SIGKILL; - char *sigenv = NULL; + char *envvar = NULL; - if (is_env_set(HEART_NO_KILL)) + envvar = get_env(HEART_NO_KILL); + if (!envvar || strcmp(envvar, "TRUE") == 0) return; - sigenv = get_env(HEART_KILL_SIGNAL); - if (sigenv && strcmp(sigenv, "SIGABRT") == 0) { + envvar = get_env(HEART_KILL_SIGNAL); + if (envvar && strcmp(envvar, "SIGABRT") == 0) { print_error("kill signal SIGABRT requested"); sig = SIGABRT; } diff --git a/lib/kernel/doc/src/heart.xml b/lib/kernel/doc/src/heart.xml index bfb4ce45e6..1ad6a04b75 100644 --- a/lib/kernel/doc/src/heart.xml +++ b/lib/kernel/doc/src/heart.xml @@ -90,10 +90,11 @@ % <input>erl -heart -env HEART_KILL_SIGNAL SIGABRT ...</input></pre> <p> If heart should <b>not</b> kill the Erlang runtime system, this can be indicated - using the environment variable <c><![CDATA[HEART_NO_KILL]]></c>. + using the environment variable <c><![CDATA[HEART_NO_KILL=TRUE]]></c>. This can be useful if the command executed by heart takes care of this, for example as part of a specific cleanup sequence. - If unset, the default behaviour will be to kill as described above. + If unset, or not set to <c><![CDATA[TRUE]]></c>, the default behaviour + will be to kill as described above. </p> <pre> diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl index a848bc78f7..16b9f7a9ee 100644 --- a/lib/kernel/test/heart_SUITE.erl +++ b/lib/kernel/test/heart_SUITE.erl @@ -650,7 +650,7 @@ suicide_by_heart() -> end. non_suicide_by_heart() -> - P = open_port({spawn,"heart -ht 11 -pid "++os:getpid()},[exit_status, {env, {"HEART_NO_KILL", "1"}}, {packet,2}]), + P = open_port({spawn,"heart -ht 11 -pid "++os:getpid()},[exit_status, {env, {"HEART_NO_KILL", "TRUE"}}, {packet,2}]), receive X -> X end, %% Just hang and wait for heart to timeout receive |