summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRicky Zhou <ricky@fedoraproject.org>2010-01-01 15:39:36 -0500
committerJames Turnbull <james@lovedthanlost.net>2010-01-02 16:09:22 +1100
commitfd631b9945cf33a1e5af849900cf6219b050e321 (patch)
tree89161cb191e8996c8aaf16b0c44c4d7aa9c1dce3 /lib
parentf878fe836e13bd564e8cb4b612e6abead7fc0821 (diff)
downloadpuppet-fd631b9945cf33a1e5af849900cf6219b050e321.tar.gz
puppet-fd631b9945cf33a1e5af849900cf6219b050e321.tar.xz
puppet-fd631b9945cf33a1e5af849900cf6219b050e321.zip
Do not close stdout or stderr in execute.
Closing stdout and stderr would sometimes cause failures when a program that is executed with squelched output tries to write to them. This reverts to the previous behavior of reopening them to /dev/null.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util.rb21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index cc2822f3b..3752a6dac 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -291,20 +291,23 @@ module Util
begin
output_read.close
- if arguments[:stdinfile]
- $stdin.reopen(arguments[:stdinfile])
- else
- $stdin.close
- end
if arguments[:squelch]
- $stdout.close
+ output_write.close
+ $stdout.reopen('/dev/null', 'w')
+ $stderr.reopen('/dev/null', 'w')
else
$stdout.reopen(output_write)
+ if arguments[:combine]
+ $stderr.reopen(output_write)
+ else
+ $stderr.reopen('/dev/null', 'w')
+ end
end
- if arguments[:combine]
- $stderr.reopen(output_write)
+
+ if arguments[:stdinfile]
+ $stdin.reopen(arguments[:stdinfile])
else
- $stderr.close
+ $stdin.close
end
3.upto(256){|fd| IO::new(fd).close rescue nil}