Reduce number of subshells generated

This commit is contained in:
Radon Rosborough 2020-08-22 16:24:15 -06:00
parent 4c0cab2572
commit e5ba8b722e
1 changed files with 5 additions and 0 deletions

View File

@ -131,5 +131,10 @@ export function privilegedTeardown({ uid, uuid }: Context) {
}
export function bash(cmdline: string) {
if (!cmdline.match(/[;|&(){}=]/)) {
// Reduce number of subshells we generate, if we're just running a
// single command (no shell logic).
cmdline = "exec " + cmdline;
}
return ["bash", "-c", cmdline];
}