complete-run: close all fds except for 0, 1, 2
running in a VIM subshell leads to one more fd, for example
This commit is contained in:
parent
b0ee2dfd32
commit
3abd7ab073
|
@ -24,10 +24,15 @@ use StartXDummy;
|
||||||
use StatusLine;
|
use StatusLine;
|
||||||
# the following modules are not shipped with Perl
|
# the following modules are not shipped with Perl
|
||||||
use AnyEvent;
|
use AnyEvent;
|
||||||
|
use AnyEvent::Util;
|
||||||
use AnyEvent::Handle;
|
use AnyEvent::Handle;
|
||||||
use AnyEvent::I3 qw(:all);
|
use AnyEvent::I3 qw(:all);
|
||||||
use X11::XCB;
|
use X11::XCB;
|
||||||
|
|
||||||
|
# Close superfluous file descriptors which were passed by running in a VIM
|
||||||
|
# subshell or situations like that.
|
||||||
|
AnyEvent::Util::close_all_fds_except(0, 1, 2);
|
||||||
|
|
||||||
# We actually use AnyEvent to make sure it loads an event loop implementation.
|
# We actually use AnyEvent to make sure it loads an event loop implementation.
|
||||||
# Afterwards, we overwrite SIGCHLD:
|
# Afterwards, we overwrite SIGCHLD:
|
||||||
my $cv = AnyEvent->condvar;
|
my $cv = AnyEvent->condvar;
|
||||||
|
|
|
@ -7,6 +7,7 @@ use IO::Socket::UNIX; # core
|
||||||
use Cwd qw(abs_path); # core
|
use Cwd qw(abs_path); # core
|
||||||
use POSIX qw(:fcntl_h); # core
|
use POSIX qw(:fcntl_h); # core
|
||||||
use AnyEvent::Handle; # not core
|
use AnyEvent::Handle; # not core
|
||||||
|
use AnyEvent::Util; # not core
|
||||||
use Exporter 'import';
|
use Exporter 'import';
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
|
@ -78,6 +79,10 @@ sub activate_i3 {
|
||||||
POSIX::close(fileno($socket));
|
POSIX::close(fileno($socket));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Make sure no file descriptors are open. Strangely, I got an open file
|
||||||
|
# descriptor pointing to AnyEvent/Impl/EV.pm when testing.
|
||||||
|
AnyEvent::Util::close_all_fds_except(0, 1, 2, 3);
|
||||||
|
|
||||||
# Construct the command to launch i3. Use maximum debug level, disable
|
# Construct the command to launch i3. Use maximum debug level, disable
|
||||||
# the interactive signalhandler to make it crash immediately instead.
|
# the interactive signalhandler to make it crash immediately instead.
|
||||||
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
|
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
|
||||||
|
|
Loading…
Reference in New Issue