Filter null/undefined arguments on Windows

These won't be able to be properly quoted
This commit is contained in:
Kevin Sawicki 2014-09-18 11:36:41 -07:00
parent c37e4649b5
commit 44860ba572

View File

@ -44,15 +44,14 @@ class BufferedProcess
if process.platform is "win32"
# Quote all arguments and escapes inner quotes
if args?
cmdArgs = args.filter (arg) -> arg?
cmdArgs = args.map (arg) ->
if command in ['explorer.exe', 'explorer'] and /^\/[a-zA-Z]+,.*$/.test(arg)
# Don't wrap /root,C:\folder style arguments to explorer calls in
# quotes since they will not be interpreted correctly if they are
arg
else if typeof arg is 'string'
"\"#{arg.replace(/"/g, '\\"')}\""
else
arg
"\"#{arg.toString().replace(/"/g, '\\"')}\""
else
cmdArgs = []
if /\s/.test(command)