diff options
author | Orestis Floros <orestisflo@gmail.com> | 2022-10-29 08:20:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 08:20:09 +0200 |
commit | 080c73d1a49fbde0d582ba445654b7069dce4f7c (patch) | |
tree | 82ea86bc2c5558acaf51a1f0379145525f92df2a | |
parent | 1f53ae461482bba8680f097d06d0a0136899b5f3 (diff) | |
download | i3-080c73d1a49fbde0d582ba445654b7069dce4f7c.tar.gz i3-080c73d1a49fbde0d582ba445654b7069dce4f7c.zip |
i3-dmenu-desktop: ignore SIGPIPE when writing to dmenu (#5228)
Fixes broken test
-rwxr-xr-x | i3-dmenu-desktop | 5 | ||||
-rw-r--r-- | testcases/t/318-i3-dmenu-desktop.t | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/i3-dmenu-desktop b/i3-dmenu-desktop index bb693350..6e26786d 100755 --- a/i3-dmenu-desktop +++ b/i3-dmenu-desktop @@ -366,9 +366,14 @@ binmode $dmenu_in, ':utf8'; binmode $dmenu_out, ':utf8'; # Feed dmenu the possible choices. +# Since the process might have already exited, we ignore SIGPIPE. +$SIG{PIPE} = 'IGNORE'; + say $dmenu_in $_ for sort keys %choices; close($dmenu_in); +$SIG{PIPE} = 'DEFAULT'; + waitpid($pid, 0); my $status = ($? >> 8); diff --git a/testcases/t/318-i3-dmenu-desktop.t b/testcases/t/318-i3-dmenu-desktop.t index 6fd78d48..2ad7f41b 100644 --- a/testcases/t/318-i3-dmenu-desktop.t +++ b/testcases/t/318-i3-dmenu-desktop.t @@ -67,10 +67,8 @@ EOT # complete-run.pl arranges for $PATH to be set up such that the # i3-dmenu-desktop version we execute is the one from the build directory. - my $exit = system("i3-dmenu-desktop --dmenu 'echo i3-testsuite-$testcnt' &"); - if ($exit != 0) { - die "failed to run i3-dmenu-desktop"; - } + my $exit = system("(i3-dmenu-desktop --dmenu 'echo i3-testsuite-$testcnt' || echo failed with \$? > $tmpdir/fifo) &"); + die "failed to start i3-dmenu-desktop" unless $exit == 0; chomp($want_arg); # trim trailing newline my $got_args = decode_json(slurp("$tmpdir/fifo")); |