diff --git a/packages/cli/src/utils/sandbox.security.test.ts b/packages/cli/src/utils/sandbox.security.test.ts index 45a41d3586e..c50d9c59ea6 100644 --- a/packages/cli/src/utils/sandbox.security.test.ts +++ b/packages/cli/src/utils/sandbox.security.test.ts @@ -11,6 +11,7 @@ vi.mock('node:child_process', () => { spawn: vi.fn(), exec: vi.fn(), execSync: vi.fn(), + execFileSync: vi.fn(), }; return { ...mockCp, diff --git a/packages/cli/src/utils/sandbox.ts b/packages/cli/src/utils/sandbox.ts index 95f23d82075..d39e1ea0613 100644 --- a/packages/cli/src/utils/sandbox.ts +++ b/packages/cli/src/utils/sandbox.ts @@ -4,7 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { exec, execSync, spawn, type ChildProcess } from 'node:child_process'; +import { + exec, + execSync, + execFileSync, + spawn, + type ChildProcess, +} from 'node:child_process'; import os from 'node:os'; import path from 'node:path'; import fs from 'node:fs'; @@ -784,7 +790,7 @@ export async function start_sandbox( // install handlers to stop proxy on exit/signal const stopProxy = () => { console.log('stopping proxy container ...'); - execSync(`${config.command} rm -f ${SANDBOX_PROXY_NAME}`); + execFileSync(config.command, ['rm', '-f', SANDBOX_PROXY_NAME]); }; process.on('exit', stopProxy); process.on('SIGINT', stopProxy);