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"));