From b92627dd5d20076ef2811aec484ce19e13942c5b Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Sat, 10 Jun 2023 01:57:14 -0400 Subject: [PATCH] fix(tools): simplify kill logic in manage-vnc-pipes --- tools/striker-manage-vnc-pipes | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/tools/striker-manage-vnc-pipes b/tools/striker-manage-vnc-pipes index 792035ed..15afaf25 100755 --- a/tools/striker-manage-vnc-pipes +++ b/tools/striker-manage-vnc-pipes @@ -454,18 +454,7 @@ sub stop_websockify return if (not is_websockify_process($parameters)); - my $shell_call = "kill ".$ws_pid; - my $call_parameters = { host_name => $host_name, shell_call => $shell_call }; - - my ($shell_output, $shell_error, $shell_return_code) = call($call_parameters); - - sleep(2); - - return if (not is_websockify_process($parameters)); - - $call_parameters->{shell_call} = $shell_call =~ s/kill/kill -9/; - - ($shell_output, $shell_error, $shell_return_code) = $anvil->Remote->call($call_parameters); + call({ host_name => $host_name, shell_call => "kill $ws_pid || kill -9 $ws_pid" }); } sub start_ssh_tunnel @@ -558,18 +547,7 @@ sub stop_ssh_tunnel return if (not is_ssh_process($parameters)); - my $shell_call = "kill ".$ssh_tunnel_pid; - my $call_parameters = { host_name => $host_name, shell_call => $shell_call }; - - my ($shell_output, $shell_error, $shell_return_code) = call($call_parameters); - - sleep(2); - - return if (not is_ssh_process($parameters)); - - $call_parameters->{shell_call} = $shell_call =~ s/kill/kill -9/; - - ($shell_output, $shell_error, $shell_return_code) = call($call_parameters); + call({ host_name => $host_name, shell_call => "kill $ssh_tunnel_pid || kill -9 $ssh_tunnel_pid" }); } sub create_vnc_pipes_table