Constructs a command line to run in a shell. The shell could be re-used/long-lived, this means we cannot spawn a new process with a nice and fresh environment, we need to encode environment modifications into the returned command.
Inspired by VS Code implementation, see: https://github.com/microsoft/vscode/blob/f395cac4fff0721a8099126172c01411812bcb4a/src/vs/workbench/contrib/debug/node/terminals.ts#L79
the host terminal process infos
program to execute in the host terminal
Protected
buildOptional
cwd: stringOptional
env: [string, null | string][]Protected
buildOptional
cwd: stringOptional
env: [string, null | string][]Protected
buildOptional
cwd: stringOptional
env: [string, null | string][]Protected
buildOptional
cwd: stringOptional
env: [string, null | string][]Protected
createThis method will try to leave arg[0]
unescaped if possible. The reason
is that shells like cmd
expect their own commands like dir
to be
unescaped.
empty string if args
is empty, otherwise an escaped command.
Protected
needsProtected
quote
Create command lines ready to be sent to a shell's stdin for evaluation.