test: use symlinks to copy shells

Git for Windows includes `C:\Program Files\Git\bin\bash.exe`,
which spawns ..\usr\bin\bash.exe, so copying that executable
won't work.

However, if a symlink is used to test paths with spaces,
this executable will still work.

PR-URL: https://github.com/nodejs/node/pull/32129
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
John Kleinschmidt 2020-04-07 11:06:32 -04:00 committed by Anna Henningsen
parent 38bf1beea9
commit 8866ff5ab1
No known key found for this signature in database
GPG Key ID: A94130F0BFC8EBE9

View File

@ -23,10 +23,10 @@ const test = (shell) => {
}));
};
const testCopy = (shellName, shellPath) => {
// Copy the executable to a path with spaces, to ensure there are no issues
// Symlink the executable to a path with spaces, to ensure there are no issues
// related to quoting of argv0
const copyPath = `${tmpPath}\\${shellName}`;
fs.copyFileSync(shellPath, copyPath);
fs.symlinkSync(shellPath, copyPath);
test(copyPath);
};