Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions workspaces/libnpmexec/lib/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const run = async ({
// literally; double quotes still expand $(), backticks, $var and "
args[0] = `'${args[0].replace(/'/g, `'\\''`)}'`
}
} else if (args.length > 0) {
// cmd.exe: double-quote so & | < > ^ are taken literally; %VAR% still
// expands inside quotes, so double %; "" is cmd's quoted literal for ".
args[0] = `"${args[0].replace(/%/g, '%%').replace(/"/g, '""')}"`
}

// turn list of args into command string
Expand Down