mirror of
https://github.com/gryf/tabbedalt.git
synced 2025-12-17 11:30:31 +01:00
Fix an issue with confirmation to close terminal.
Sometimes, it happens that closing terminal with mouse/keyboard confirmation dialog appears (no matter if it was graphical or the one build on top of urxvt overlay). The culprit was with lines origin from `ps` command, which wasn't correctly split, but, what is more important, wasn't properly trimmed. This commit fixing the issue by removing whitespace from both ends of the string and splitting using space character rather, than regexp, and second, be sure to chop off all the whitespace characters before splitting line and after splitting process name and its arguments.
This commit is contained in:
13
tabbedalt
13
tabbedalt
@@ -158,6 +158,10 @@
|
|||||||
#
|
#
|
||||||
# 2024-06-10 10:34:47
|
# 2024-06-10 10:34:47
|
||||||
# - Added option for disabling activity marks and colors
|
# - Added option for disabling activity marks and colors
|
||||||
|
#
|
||||||
|
# 2024-12-10 18:30:22
|
||||||
|
# - Fix an issue with requesting closing terminal, which appear to be a
|
||||||
|
# single instance
|
||||||
|
|
||||||
use Scalar::Util;
|
use Scalar::Util;
|
||||||
|
|
||||||
@@ -660,11 +664,12 @@ _on wm_delete_window => sub {
|
|||||||
my %process_to_skip = ( "bash"=>1, "zsh"=>1, "ps"=>1, "fish"=>1, "sh"=>1 );
|
my %process_to_skip = ( "bash"=>1, "zsh"=>1, "ps"=>1, "fish"=>1, "sh"=>1 );
|
||||||
|
|
||||||
foreach my $line (@subprocesses) {
|
foreach my $line (@subprocesses) {
|
||||||
chomp $line;
|
$line =~ s/^\s+|\s+$//g;
|
||||||
my @split_line = split(/ /, $line);
|
my @split_line = split(" ", $line);
|
||||||
my $pid = @split_line[0];
|
my $pid = @split_line[0];
|
||||||
my $proc_name = @split_line[1];
|
my @line = split(" ", @split_line[1]);
|
||||||
chomp $proc_name;
|
my $proc_name = @line[0];
|
||||||
|
$proc_name =~ s/^\s+|\s+$//g;
|
||||||
if (!exists $process_to_skip{$proc_name}) {
|
if (!exists $process_to_skip{$proc_name}) {
|
||||||
$subp_count = $subp_count + 1;
|
$subp_count = $subp_count + 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user