aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/common/heart.c
diff options
context:
space:
mode:
authorSimon Cornish <[email protected]>2016-04-25 22:21:07 -0700
committerSimon Cornish <[email protected]>2016-06-01 14:56:24 +0200
commit45a4a46333b1e8e6f66ba923deaf947a67ae7737 (patch)
treefeacad1dc2e8ca4e675aba503eafd20831491ce8 /erts/etc/common/heart.c
parent523e048754f5086a6cc4fd9a250e1b495fc5b9b8 (diff)
downloadotp-45a4a46333b1e8e6f66ba923deaf947a67ae7737.tar.gz
otp-45a4a46333b1e8e6f66ba923deaf947a67ae7737.tar.bz2
otp-45a4a46333b1e8e6f66ba923deaf947a67ae7737.zip
Don't kill old erlang if HEART_NO_KILL is set
If the environment variable HEART_NO_KILL is set then heart won't kill the old erlang process. This is desirable if the command executed by heart takes care of this.
Diffstat (limited to 'erts/etc/common/heart.c')
-rw-r--r--erts/etc/common/heart.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/etc/common/heart.c b/erts/etc/common/heart.c
index 1a826221fb..b6fbfd075c 100644
--- a/erts/etc/common/heart.c
+++ b/erts/etc/common/heart.c
@@ -119,6 +119,8 @@
#define HEART_COMMAND_ENV "HEART_COMMAND"
#define ERL_CRASH_DUMP_SECONDS_ENV "ERL_CRASH_DUMP_SECONDS"
#define HEART_KILL_SIGNAL "HEART_KILL_SIGNAL"
+#define HEART_NO_KILL "HEART_NO_KILL"
+
#define MSG_HDR_SIZE (2)
#define MSG_HDR_PLUS_OP_SIZE (3)
@@ -524,6 +526,10 @@ static void
kill_old_erlang(void){
HANDLE erlh;
DWORD exit_code;
+
+ if (is_env_set(HEART_NO_KILL))
+ return;
+
if(heart_beat_kill_pid != 0){
if((erlh = OpenProcess(PROCESS_TERMINATE |
SYNCHRONIZE |
@@ -557,6 +563,9 @@ kill_old_erlang(void){
int sig = SIGKILL;
char *sigenv = NULL;
+ if (is_env_set(HEART_NO_KILL))
+ return;
+
sigenv = get_env(HEART_KILL_SIGNAL);
if (sigenv && strcmp(sigenv, "SIGABRT") == 0) {
print_error("kill signal SIGABRT requested");