From 16eab59cc1b352faac966901a301dfaa012e99da Mon Sep 17 00:00:00 2001 From: Alexey Avramov Date: Mon, 14 Jan 2019 06:12:27 +0900 Subject: [PATCH] fix new conf --- nohang | 8 ++++---- nohang.conf | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nohang b/nohang index 572f64f..d1c739f 100755 --- a/nohang +++ b/nohang @@ -768,7 +768,7 @@ def find_victim_and_send_signal(signal): command = etc_dict[name] if stop_cont: os.kill(int(pid), SIGCONT) - exit_status = os.system(etc_dict[name].replace('$PID', pid)) + exit_status = os.system(etc_dict[name].replace('$PID', pid)).replace('$NAME', pid_to_name(pid))) if exit_status == 0: exit_status = '\033[32m0\033[0m' else: @@ -779,11 +779,11 @@ def find_victim_and_send_signal(signal): etc_info = '{}' \ '\n\033[4mImplement corrective action:\033[0m\n Execute the command: \033[4m{}\033[0m' \ '\n Exit status: {}; response time: {} ms'.format( - victim_info, command.replace('$PID', pid), exit_status, + victim_info, command.replace('$PID', pid).replace('$NAME', pid_to_name(pid)), exit_status, round(response_time * 1000)) # update stat_dict - key = "Run the command '\033[35m{}\033[0m'".format(command.replace('$PID', pid)) + key = "Run the command '\033[35m{}\033[0m'".format(command.replace('$PID', pid).replace('$NAME', pid_to_name(pid))) print(key) update_stat_dict_and_print(key) @@ -791,7 +791,7 @@ def find_victim_and_send_signal(signal): print(etc_info) if gui_notifications: - send_notify_etc(pid, name, command.replace('$PID', pid)) + send_notify_etc(pid, name, command.replace('$PID', pid).replace('$NAME', pid_to_name(pid))) else: diff --git a/nohang.conf b/nohang.conf index 696c916..0a9c651 100644 --- a/nohang.conf +++ b/nohang.conf @@ -238,6 +238,8 @@ execute_the_command = False It is way to send any signal instead of SIGTERM. (run `kill -L` to see list of all signals) + Also $NAME will be replaced by process name. + $ETC bash /// kill -9 $PID $ETC firefox-esr /// kill -SEGV $PID