node-shell-escape icon indicating copy to clipboard operation
node-shell-escape copied to clipboard

Empty string argument should be quoted

Open njam opened this issue 7 years ago • 1 comments

Currently an empty string argument becomes an empty string, and is thus ignored by the shell:

$ node -e "let esc = require('shell-escape'); console.log('|' + esc(['']) + '|')"
||

Instead an empty string should become as '' I think.

njam avatar Jul 06 '18 21:07 njam

If I may suggest this, it is often better to try to use something like cross-spawn which accepts an array of arguments and knows how to target the current platform (see #9). You will have a more portable and safe program if you use that approach.

binki avatar Jul 07 '18 14:07 binki