grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Improperly split arguments

Open RevanProdigalKnight opened this issue 9 years ago • 3 comments

The provided arguments in this call:

grunt task:arg1:"arg2 with spaces":"arg3 : blah"

Should be split out into "arg1", "arg2 with spaces", and "arg3 : blah", but they will actually be split out into "arg1", "arg2 with spaces", "arg3, and blah" because of the colon inside of arg3

I realize this is a bit of an edge case, and I've only encountered it as a problem this one time.

RevanProdigalKnight avatar Feb 09 '16 19:02 RevanProdigalKnight

That's more about how the command line is parsed in general on Unix/Linux. Note this result on the command line:

> node -e "console.log(process.argv)" task:arg1:"arg2 with spaces":"arg3 : blah"
[ 'C:\\Program Files\\nodejs\\node.exe', 'task:arg1:arg2 with spaces:arg3 : blah' ]

Notice how there is only one argument. The quoting prevents spaces from starting a new arg in the shell, but the shell removes those quotes before node/Grunt gets the command line.

It looks like colons can be escaped using a backslash but that never made it into the docs, so this is probably just a docs issue.

dmethvin avatar Feb 09 '16 20:02 dmethvin

cc @JKAussieSkater

vladikoff avatar Feb 09 '16 20:02 vladikoff

Awesome, noted!

JKVeganAbroad avatar Feb 09 '16 21:02 JKVeganAbroad