[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:41 UTC 2009


The following commit has been merged in the master branch:
commit d32d7f30f672e59c1427d9dfe32e7b7be35a48ab
Author: James Turnbull <james at lovedthanlost.net>
Date:   Wed Nov 19 18:44:41 2008 +1100

    Fixed #1752 - Add an optional argument to Puppet::Util.execute to determine     whether stderr and stdout are combined in the output

diff --git a/CHANGELOG b/CHANGELOG
index 2399b23..00392f0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 0.24.x
+    Fixed #1752 - Add an optional argument to Puppet::Util.execute to determine 
+    whether stderr and stdout are combined in the output
+    
     Added versionable feature to the RPM provider
 
     Moved RRD feature from util/metric.rb to feature/base.rb
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 59f732d..09c94c3 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -268,7 +268,7 @@ module Util
 
     # Execute the desired command, and return the status and output.
     # def execute(command, failonfail = true, uid = nil, gid = nil)
-    def execute(command, arguments = {:failonfail => true})
+    def execute(command, arguments = {:failonfail => true, :combine => true})
         if command.is_a?(Array)
             command = command.flatten.collect { |i| i.to_s }
             str = command.join(" ")
@@ -301,9 +301,13 @@ module Util
 
         # The idea here is to avoid IO#read whenever possible.
         output_file="/dev/null"
+        error_file="/dev/null"
         if ! arguments[:squelch]
             require "tempfile"
             output_file = Tempfile.new("puppet")
+            if arguments[:combine]
+                error_file=output_file
+            end
         end
 
         oldverb = $VERBOSE
@@ -319,7 +323,8 @@ module Util
             begin
                 $stdin.reopen("/dev/null")
                 $stdout.reopen(output_file)
-                $stderr.reopen(output_file)
+                $stderr.reopen(error_file)
+
                 3.upto(256){|fd| IO::new(fd).close rescue nil} 
                 if arguments[:gid]
                     Process.egid = arguments[:gid]

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list