[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:34:21 UTC 2010
The following commit has been merged in the upstream branch:
commit 47c9dd16df3a31dddb486bc4d583ff3b86b0ac01
Author: David Schmitt <david at dasz.at>
Date: Fri May 14 13:13:37 2010 +0200
Implement "forking" for Windows
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 1069552..3dd84f9 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -275,31 +275,53 @@ module Util
end
end
- oldverb = $VERBOSE
- $VERBOSE = nil
- child_pid = Kernel.fork
- $VERBOSE = oldverb
- if child_pid
- # Parent process executes this
+ if Puppet.features.posix?
+ oldverb = $VERBOSE
+ $VERBOSE = nil
+ child_pid = Kernel.fork
+ $VERBOSE = oldverb
+ if child_pid
+ # Parent process executes this
+ child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8
+ else
+ # Child process executes this
+ Process.setsid
+ begin
+ if arguments[:stdinfile]
+ $stdin.reopen(arguments[:stdinfile])
+ else
+ $stdin.reopen("/dev/null")
+ end
+ $stdout.reopen(output_file)
+ $stderr.reopen(error_file)
+
+ 3.upto(256){|fd| IO::new(fd).close rescue nil}
+ if arguments[:gid]
+ Process.egid = arguments[:gid]
+ Process.gid = arguments[:gid] unless @@os == "Darwin"
+ end
+ if arguments[:uid]
+ Process.euid = arguments[:uid]
+ Process.uid = arguments[:uid] unless @@os == "Darwin"
+ end
+ ENV['LANG'] = ENV['LC_ALL'] = ENV['LC_MESSAGES'] = ENV['LANGUAGE'] = 'C'
+ if command.is_a?(Array)
+ Kernel.exec(*command)
+ else
+ Kernel.exec(command)
+ end
+ rescue => detail
+ puts detail.to_s
+ exit!(1)
+ end # begin; rescue
+ end # if child_pid
+ elsif Puppet.features.win32?
+ command = command.collect {|part| '"' + part.gsub(/"/, '\\"') + '"'}.join(" ") if command.is_a?(Array)
+ Puppet.debug "Creating process '%s'" % command
+ processinfo = Process.create(
+ :command_line => command )
child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8
- else
- # Child process executes this
- Process.setsid
- begin
- $stdin.reopen(arguments[:stdinfile] || "/dev/null")
- $stdout.reopen(output_file)
- $stderr.reopen(error_file)
-
- 3.upto(256){|fd| IO::new(fd).close rescue nil}
- Process::GID.change_privilege arguments[:gid] if arguments[:gid]
- Process::UID.change_privilege arguments[:uid] if arguments[:uid]
- ENV['LANG'] = ENV['LC_ALL'] = ENV['LC_MESSAGES'] = ENV['LANGUAGE'] = 'C'
- Kernel.exec(*command)
- rescue => detail
- puts detail.to_s
- exit!(1)
- end # begin; rescue
- end # if child_pid
+ end # if posix or win32
# read output in if required
if ! arguments[:squelch]
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list