summaryrefslogtreecommitdiff
path: root/lib/chef/util/powershell
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-08-20 21:40:51 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-19 12:47:33 -0700
commit7e5daa0ef8486275c82e694d1862d56b5a21f417 (patch)
tree1c4232d2b4e395c74127324066043aac358068b4 /lib/chef/util/powershell
parent82f957acf2e17eeeb6415f804f082a5beb6b0d3d (diff)
downloadchef-7e5daa0ef8486275c82e694d1862d56b5a21f417.tar.gz
Added unit test for powershell cmdlet
Diffstat (limited to 'lib/chef/util/powershell')
-rw-r--r--lib/chef/util/powershell/cmdlet.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index 0120f0aaf9..71bd876e40 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -90,7 +90,7 @@ class Chef::Util::Powershell
end
def escape_parameter_value(parameter_value)
- parameter_value.gsub(/\`|\'|\"/,'`\1')
+ parameter_value.gsub(/(`|'|"|#)/,'`\1')
end
def escape_string_parameter_value(parameter_value)
@@ -122,7 +122,7 @@ class Chef::Util::Powershell
raise ArgumentError, "Invalid argument type `#{switch_value.class}` specified for PowerShell switch `:#{switch_name.to_s}`. Arguments to PowerShell must be of type `String`, `Numeric`, `Float`, `FalseClass`, or `TrueClass`"
end
- switch_present ? ["-#{switch_name.to_s.downcase}", switch_argument].join(' ') : ''
+ switch_present ? ["-#{switch_name.to_s.downcase}", switch_argument].join(' ').strip : ''
end
command_switches.join(' ')