From 9cf281cf4a46d31c90fa9df41b8a857a4cf503c0 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 29 Jan 2016 11:47:31 +0100 Subject: [PATCH] run_in_background: redirect to /dev/null instead of using close This the called program can still successfully read/write to stdin, stdout, stderr and the output is discarded. --- Build.PL | 1 + bin/fcscs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Build.PL b/Build.PL index 57f0ad4..6fbf85a 100644 --- a/Build.PL +++ b/Build.PL @@ -31,6 +31,7 @@ my $build = Module::Build->new( # Bundled with perl. 'Encode' => 0, 'Fcntl' => 0, + 'File::Spec' => 0, 'File::Temp' => 0, 'I18N::Langinfo' => 0, 'Pod::Usage' => 0, diff --git a/bin/fcscs b/bin/fcscs index c44b8ea..35e50e3 100755 --- a/bin/fcscs +++ b/bin/fcscs @@ -502,9 +502,11 @@ sub run_in_background { # Necessary for GNU screen or it'll keep the window open until an # external command has run. - close STDIN or die $!; - close STDOUT or die $!; - close STDERR or die $!; + require File::Spec; + my $devnull = File::Spec->devnull(); + open STDIN, '<', $devnull or die $!; + open STDOUT, '>', $devnull or die $!; + open STDERR, '>', $devnull or die $!; # Double-fork to prevent zombies. my $pid = fork; -- 2.43.2