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
ProtectedbuildOptionalcwd: stringOptionalenv: [string, null | string][]ProtectedbuildOptionalcwd: stringOptionalenv: [string, null | string][]ProtectedbuildOptionalcwd: stringOptionalenv: [string, null | string][]ProtectedbuildOptionalcwd: stringOptionalenv: [string, null | string][]ProtectedcreateThis 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.
ProtectedneedsIf this method returns false then we definitely need quoting.
May return false positives.
Protectedquote
Create command lines ready to be sent to a shell's stdin for evaluation.