diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-30 13:18:47 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosh@opscode.com> | 2012-05-10 14:43:54 -0400 |
commit | 110a028f1b1782d7ce6f6d9b871059263ca05b69 (patch) | |
tree | bafe43433c2524202e14ea8b7822f1f646f2fc4d /lib | |
parent | 125501593717ae7954ab00dfa39a09a02a74f6dc (diff) | |
download | mixlib-shellout-110a028f1b1782d7ce6f6d9b871059263ca05b69.tar.gz |
[CHEF-2994][WINDOWS] Fixed multiple quotes in command
CMD.exe does not parse multiple quotes well unless the whole thing is wrapped up in quotes.
Workaround:
https://github.com/opscode/mixlib-shellout/pull/2#issuecomment-4837859
http://ss64.com/nt/syntax-esc.html
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mixlib/shellout/windows.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mixlib/shellout/windows.rb b/lib/mixlib/shellout/windows.rb index 89bdc22..7f55da5 100644 --- a/lib/mixlib/shellout/windows.rb +++ b/lib/mixlib/shellout/windows.rb @@ -178,7 +178,11 @@ module Mixlib if exe.nil? || exe =~ IS_BATCH_FILE # Batch files MUST use cmd; and if we couldn't find the command we're looking for, we assume it must be a cmd builtin. - [ ENV['COMSPEC'], "cmd /c #{command}" ] + # + # cmd does not parse multiple quotes well unless the whole thing is wrapped up in quotes. + # https://github.com/opscode/mixlib-shellout/pull/2#issuecomment-4837859 + # http://ss64.com/nt/syntax-esc.html + [ ENV['COMSPEC'], "cmd /c \"#{command}\"" ] else [ exe, command ] end |