i3status-timers.json-io: remap stdio to /dev/null on spawn()
This commit is contained in:
@@ -508,9 +508,10 @@ sub spawn (@) {
|
|||||||
return;
|
return;
|
||||||
} elsif ($pid == 0) { # Child
|
} elsif ($pid == 0) { # Child
|
||||||
# we need no io streams here, right?
|
# we need no io streams here, right?
|
||||||
close STDOUT;
|
# it seems that at least vscode creashes if we close stdio handles
|
||||||
close STDERR;
|
open(STDOUT, ">", "/dev/null");
|
||||||
close STDIN;
|
open(STDERR, ">", "/dev/null");
|
||||||
|
open(STDIN, "<", "/dev/null");
|
||||||
my $prg = shift(@args);
|
my $prg = shift(@args);
|
||||||
# weird situation, silently quit here :)
|
# weird situation, silently quit here :)
|
||||||
exit 0 unless(defined($prg));
|
exit 0 unless(defined($prg));
|
||||||
@@ -521,6 +522,6 @@ sub spawn (@) {
|
|||||||
exec $prg;
|
exec $prg;
|
||||||
}
|
}
|
||||||
} else { # Unable to fork()
|
} else { # Unable to fork()
|
||||||
warn "ERROR: Could not fork new process: $!\n";
|
syswrite STDERR, "[{\"full_text\":\"ERROR: Could not fork new process: $!\",\"color\":\"#ff0000\"}],\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user