Skip to content

Commit 35b332c

Browse files
Merge pull request #287 from gimmyxd/MODULES-10963
(MODULES-10963) remove win32-process on Puppet 7
2 parents fa0198e + 6f22a7a commit 35b332c

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)