i3-dmenu-desktop: ignore SIGPIPE when writing to dmenu (#5228)

Fixes broken test
This commit is contained in:
Orestis Floros 2022-10-29 08:20:09 +02:00 committed by GitHub
parent 1f53ae4614
commit 080c73d1a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

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

View File

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