summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-05-28 18:10:42 -0700
committerPete Higgins <pete@peterhiggins.org>2020-06-03 11:46:53 -0700
commitb0a0e868692f9ac8f124ae640110c513d43b5324 (patch)
tree3ab67c54a9b2130ac07bdb3eefa0ec605ab1d8e7
parent6ffb5cafd1292a0a5f2149f82e2b978db120607d (diff)
downloadchef-b0a0e868692f9ac8f124ae640110c513d43b5324.tar.gz
Move some code out of the action block to its own method.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--lib/chef/provider/windows_script.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb
index 050407030a..f46acc60d9 100644
--- a/lib/chef/provider/windows_script.rb
+++ b/lib/chef/provider/windows_script.rb
@@ -43,9 +43,7 @@ class Chef
end
end
- public
-
- action :run do
+ def with_wow64_redirection_disabled
wow64_redirection_state = nil
if wow64_architecture_override_required?(run_context.node, target_architecture)
@@ -53,7 +51,7 @@ class Chef
end
begin
- super()
+ yield
rescue
raise
ensure
@@ -63,6 +61,14 @@ class Chef
end
end
+ public
+
+ action :run do
+ with_wow64_redirection_disabled do
+ super()
+ end
+ end
+
def script_file
@script_file ||= Tempfile.open(["chef-script", script_extension])
end