Skip to content

Commit 6f22a7a

Browse files
committed
(MODULES-10963) remove win32-process on Puppet 7
Puppet 7 dropped the dependecy on win32-process gem in favour of monkey patching the Process Module. As a reppercusion, require `win32/process` will no longer work on Puppet >= 7.0.0. This commit updates the reboot task to only require that specific gem if Puppet < 7.0.0
1 parent fa0198e commit 6f22a7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tasks/init.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ def async_command(cmd, wait_time = nil)
3939
when 'windows'
4040
# This appears to be the only way to get the processes to properly detach
4141
# themselves, it was a HUGE PAIN to fugure out
42-
require 'win32/process'
42+
# win32/process is needed on Puppet < 7
43+
# Puppet 7 monkey patches Ruby's Process Module
44+
# and Process.create will be available
45+
require 'puppet'
46+
require 'win32/process' if Puppet::Util::Package.versioncmp(Puppet.version, '7.0.0') < 0
47+
4348
Process.create(
4449
command_line: "cmd /c start #{cmd}",
4550
creation_flags: Process::DETACHED_PROCESS,

0 commit comments

Comments
 (0)