From 2ea4fa072621b7ecc795070f812b80bd3bd331ee Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 20 Sep 2024 16:02:03 +0200 Subject: [PATCH] fixup! test: do not assume `process.execPath` contains no spaces --- test/sequential/test-cli-syntax-file-not-found.js | 3 ++- test/sequential/test-cli-syntax-good.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/sequential/test-cli-syntax-file-not-found.js b/test/sequential/test-cli-syntax-file-not-found.js index 74ab521f1c1186..189d6b8d58f349 100644 --- a/test/sequential/test-cli-syntax-file-not-found.js +++ b/test/sequential/test-cli-syntax-file-not-found.js @@ -8,9 +8,10 @@ const fixtures = require('../common/fixtures'); // The execPath might contain chars that should be escaped in a shell context. // On non-Windows, we can pass the path via the env; `"` is not a valid char on // Windows, so we can simply pass the path. -const execNode = (flag, file) => exec( +const execNode = (flag, file, callback) => exec( `"${common.isWindows ? process.execPath : '$NODE'}" ${flag} "${common.isWindows ? file : '$FILE'}"`, common.isWindows ? undefined : { env: { ...process.env, NODE: process.execPath, FILE: file } }, + callback, ); // Test both sets of arguments that check syntax diff --git a/test/sequential/test-cli-syntax-good.js b/test/sequential/test-cli-syntax-good.js index 3b705c82993ff0..24c68781876556 100644 --- a/test/sequential/test-cli-syntax-good.js +++ b/test/sequential/test-cli-syntax-good.js @@ -8,9 +8,10 @@ const fixtures = require('../common/fixtures'); // The execPath might contain chars that should be escaped in a shell context. // On non-Windows, we can pass the path via the env; `"` is not a valid char on // Windows, so we can simply pass the path. -const execNode = (flag, file) => exec( +const execNode = (flag, file, callback) => exec( `"${common.isWindows ? process.execPath : '$NODE'}" ${flag} "${common.isWindows ? file : '$FILE'}"`, common.isWindows ? undefined : { env: { ...process.env, NODE: process.execPath, FILE: file } }, + callback, ); // Test both sets of arguments that check syntax