Skip to content

Commit 6fcaef2

Browse files
committed
(PUP-11348) Omit unnecessary mode parameter
1 parent 503c50b commit 6fcaef2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/puppet/provider/exec/windows.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def checkexe(command)
4545
end
4646

4747
if resource[:path]
48-
Puppet::Util.withenv( {'PATH' => resource[:path].join(File::PATH_SEPARATOR)}, :windows) do
48+
Puppet::Util.withenv('PATH' => resource[:path].join(File::PATH_SEPARATOR)) do
4949
return if which(exe)
5050
end
5151
end

lib/puppet/util/execution.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def self.execute_windows(command, options, stdin, stdout, stderr)
379379
end.join(" ") if command.is_a?(Array)
380380

381381
options[:custom_environment] ||= {}
382-
Puppet::Util.withenv(options[:custom_environment], :windows) do
382+
Puppet::Util.withenv(options[:custom_environment]) do
383383
Puppet::Util::Windows::Process.execute(command, options, stdin, stdout, stderr)
384384
end
385385
end

spec/integration/defaults_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@
137137

138138
it "path should not add anything" do
139139
path = "c:\\windows\\system32#{File::PATH_SEPARATOR}c:\\windows"
140-
Puppet::Util.withenv( {"PATH" => path }, :windows ) do
140+
Puppet::Util.withenv("PATH" => path) do
141141
Puppet.settings[:path] = "none" # this causes it to ignore the setting
142142
expect(ENV["PATH"]).to eq(path)
143143
end
144144
end
145145

146146
it "path should support UTF8 characters" do
147147
path = "c:\\windows\\system32#{File::PATH_SEPARATOR}c:\\windows#{File::PATH_SEPARATOR}C:\\" + rune_utf8
148-
Puppet::Util.withenv( {"PATH" => path }, :windows) do
148+
Puppet::Util.withenv("PATH" => path) do
149149
Puppet.settings[:path] = "none" # this causes it to ignore the setting
150150

151151
expect(ENV['Path']).to eq(path)

spec/integration/util_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
Puppet::FileSystem.touch(filepath)
9797

9898
path = [utf8, "c:\\windows\\system32", "c:\\windows"].join(File::PATH_SEPARATOR)
99-
Puppet::Util.withenv( { "PATH" => path } , :windows) do
99+
Puppet::Util.withenv("PATH" => path) do
100100
expect(Puppet::Util.which(filename)).to eq(filepath)
101101
end
102102
end

spec/unit/util_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def get_mode(file)
129129
ENV[env_key] = original_value
130130
new_value = 'goodbye'
131131

132-
Puppet::Util.withenv({env_key.upcase => new_value}, :posix) do
132+
Puppet::Util.withenv(env_key.upcase => new_value) do
133133
expect(ENV[env_key]).to eq(original_value)
134134
expect(ENV[env_key.upcase]).to eq(new_value)
135135
end
@@ -154,7 +154,7 @@ def get_mode(file)
154154
ENV[env_key] = original_value
155155
new_value = 'goodbye'
156156

157-
Puppet::Util.withenv({env_key.upcase => new_value}, :windows) do
157+
Puppet::Util.withenv(env_key.upcase => new_value) do
158158
expect(ENV[env_key]).to eq(new_value)
159159
expect(ENV[env_key.upcase]).to eq(new_value)
160160
end
@@ -174,7 +174,7 @@ def withenv_utf8(&block)
174174
utf_8_value = utf_8_key + 'value'
175175
codepage_key = utf_8_key.dup.force_encoding(Encoding.default_external)
176176

177-
Puppet::Util.withenv({utf_8_key => utf_8_value}, :windows) do
177+
Puppet::Util.withenv(utf_8_key => utf_8_value) do
178178
# the true Windows environment APIs see the variables correctly
179179
expect(process.get_environment_strings[utf_8_key]).to eq(utf_8_value)
180180

@@ -201,7 +201,7 @@ def withenv_utf8(&block)
201201
process.set_environment_variable(env_var_name, utf_8_str)
202202

203203
original_keys = process.get_environment_strings.keys.to_a
204-
Puppet::Util.withenv({}, :windows) { }
204+
Puppet::Util.withenv({}) { }
205205

206206
env = process.get_environment_strings
207207

0 commit comments

Comments
 (0)