Please review pull request #556: (#12914) Allow puppet to be interrupted while waiting for child process opened by (joshcooper)
Description:
Previously, puppet on Windows could not be interrupted, e.g. Ctrl-C,
while waiting for a child process it executed to exit. For example,
when executing a pre/post run command.
This commit changes puppet to poll the state of the child process'
handle, sleeping for 1 second in between.
- Opened: Sat Mar 03 00:33:18 UTC 2012
- Based on: puppetlabs:2.7rc (51a3090d9348bda6f82b27d0cac67e919983660a)
- Requested merge: joshcooper:ticket/2.7.x/12914-poll-child (1d058ce233aeb2f70e1612c56dac52aa5f9c4387)
Diff follows:
diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb
index 782a381..abeb592 100644
--- a/lib/puppet/util/windows/process.rb
+++ b/lib/puppet/util/windows/process.rb
@@ -11,7 +11,9 @@ def execute(command, arguments, stdin, stdout, stderr)
module_function :execute
def wait_process(handle)
- WaitForSingleObject(handle, Windows::Synchronize::INFINITE)
+ while WaitForSingleObject(handle, 0) == Windows::Synchronize::WAIT_TIMEOUT
+ sleep(1)
+ end
exit_status = [0].pack('L')
unless GetExitCodeProcess(handle, exit_status)
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
