From: Michael Stapelberg Date: Tue, 4 Oct 2011 18:58:17 +0000 (+0100) Subject: tests: make complete-run use POSIX::close(3) instead of reserving a file descriptor... X-Git-Tag: 4.1~122^2~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=20d6ae4110bfec1921b62a185921255ef719e042;p=i3%2Fi3 tests: make complete-run use POSIX::close(3) instead of reserving a file descriptor when starting This makes it possible to run complete-run.pl with a "tainted" environment in which fd 3 (and possibly others) are already present. --- diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 52038b33..aa32557d 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -33,15 +33,6 @@ use IO::Socket::UNIX; # core use POSIX; # core use AnyEvent::Handle; -# open a file so that we get file descriptor 3. we will later close it in the -# child and dup() the listening socket file descriptor to 3 to pass it to i3 -open(my $reserved, '<', '/dev/null'); -if (fileno($reserved) != 3) { - warn "Socket file descriptor is not 3."; - warn "Please don't start this script within a subshell of vim or something."; - exit 1; -} - # install a dummy CHLD handler to overwrite the CHLD handler of AnyEvent / EV # XXX: we could maybe also use a different loop than the default loop in EV? $SIG{CHLD} = sub { @@ -165,7 +156,7 @@ sub take_job { $ENV{DISPLAY} = $display; $^F = 3; - close($reserved); + POSIX::close(3); POSIX::dup2(fileno($socket), 3); # now execute i3