Fix JS build on Windows (#1648)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1648

Node made a breaking change in a security release for 18/20 where `spawn()` no longer loads `.bat` files by default. 69ffc6d50d. Execute command in shell.

Reviewed By: javache

Differential Revision: D56230965

fbshipit-source-id: 52e9bd8a76664bd07ea25b6355ac54fcb24cbb9a
This commit is contained in:
Nick Gerleman
2024-04-17 03:03:02 -07:00
committed by Nick Gerleman
parent 1b9b878b9a
commit af57b2164d

View File

@@ -168,9 +168,9 @@ function installEmsdkTask() {
{stdio: 'inherit'}, {stdio: 'inherit'},
); );
await spawn(emsdkBin, ['install', emsdkVersion], {stdio: 'inherit'}); await spawnShell(emsdkBin, ['install', emsdkVersion], {stdio: 'inherit'});
await spawn(emsdkBin, ['activate', emsdkVersion], { await spawnShell(emsdkBin, ['activate', emsdkVersion], {
stdio: logger.enableVerbose ? 'inherit' : 'ignore', stdio: logger.enableVerbose ? 'inherit' : 'ignore',
}); });
}; };
@@ -216,7 +216,7 @@ function emcmakeGenerateTask() {
]; ];
logger.info(['emcmake', ...args].join(' ')); logger.info(['emcmake', ...args].join(' '));
return spawn(emcmakeBin, args, { return spawnShell(emcmakeBin, args, {
stdio: logger.enableVerbose ? 'inherit' : 'ignore', stdio: logger.enableVerbose ? 'inherit' : 'ignore',
}); });
}; };
@@ -234,7 +234,7 @@ function cmakeBuildTask(opts) {
]; ];
logger.info(['cmake', ...args].join(' ')); logger.info(['cmake', ...args].join(' '));
return spawn(cmake, args, {stdio: 'inherit'}); return spawnShell(cmake, args, {stdio: 'inherit'});
}; };
} }
@@ -246,8 +246,13 @@ function clangFormatTask(opts) {
]; ];
logger.info(['clang-format', ...args].join(' ')); logger.info(['clang-format', ...args].join(' '));
return spawn(node, [require.resolve('clang-format'), ...args], { return spawnShell(node, [require.resolve('clang-format'), ...args], {
stdio: 'inherit', stdio: 'inherit',
}); });
}; };
} }
function spawnShell(cmd, args, opts) {
// https://github.com/nodejs/node/issues/52554
return spawn(cmd, args, {...opts, shell: true});
}