From e5ba8b722e885860d0a94be5377befab19d766b8 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 22 Aug 2020 16:24:15 -0600 Subject: [PATCH] Reduce number of subshells generated --- backend/src/util.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/util.ts b/backend/src/util.ts index ba4e588..bffbce4 100644 --- a/backend/src/util.ts +++ b/backend/src/util.ts @@ -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]; }