diff options
| author | pbuetow <puppet@mx.buetow.org> | 2012-03-15 14:19:04 +0100 |
|---|---|---|
| committer | pbuetow <puppet@mx.buetow.org> | 2012-03-15 14:19:04 +0100 |
| commit | 825461f10026f4ba39cf3f0a363914c0552a817b (patch) | |
| tree | 9c3cad210bad153b8d3d72107e495a5fec9cb05c | |
| parent | c5bb4a908942ad2c9a035b46b448d94d33420981 (diff) | |
nicer output on terminating pids
| -rwxr-xr-x | loadbars | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -102,6 +102,7 @@ sub null ($) { defined $_[0] ? $_[0] : 0 } sub notnull ($) { $_[0] != 0 ? $_[0] : 1 } sub set_showcores_regexp () { $I{cpuregexp} = $C{showcores} ? 'cpu' : 'cpu ' } sub error ($) { die shift, "\n" } +sub display_info_no_nl ($) { print "==> " . shift . ' ' } sub display_info ($) { say "==> " . shift } sub display_warn ($) { say "!!! " . shift } @@ -198,19 +199,22 @@ sub terminate_pids (@) { display_info 'Terminating sub-processes, hasta la vista!'; $_->kill('TERM') for @threads; + display_info_no_nl 'Terminating PIDs'; for my $pid (@PIDS) { my $proc_table = Proc::ProcessTable->new(); for my $proc (@{$proc_table->table()}) { if ($proc->ppid == $pid) { - display_info "Terminating PID ".$proc->pid; + print $proc->pid . ' '; kill 'TERM', $proc->pid if $proc->ppid == $pid; } } - display_info "Terminating PID $pid"; + print $pid . ' '; kill 'TERM', $pid; } + say ''; + display_info 'Terminating done. I\'ll be back!'; } |
