Skip to content

Commit

Permalink
Fix JS build on Windows (facebook#1648)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1648

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

Reviewed By: javache

Differential Revision: D56230965

fbshipit-source-id: 52e9bd8a76664bd07ea25b6355ac54fcb24cbb9a
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Apr 17, 2024
1 parent cd4a1b8 commit c0239e3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions javascript/just.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ function installEmsdkTask() {
{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',
});
};
Expand Down Expand Up @@ -216,7 +216,7 @@ function emcmakeGenerateTask() {
];
logger.info(['emcmake', ...args].join(' '));

return spawn(emcmakeBin, args, {
return spawnShell(emcmakeBin, args, {
stdio: logger.enableVerbose ? 'inherit' : 'ignore',
});
};
Expand All @@ -234,7 +234,7 @@ function cmakeBuildTask(opts) {
];
logger.info(['cmake', ...args].join(' '));

return spawn(cmake, args, {stdio: 'inherit'});
return spawnShell(cmake, args, {stdio: 'inherit'});
};
}

Expand All @@ -246,8 +246,13 @@ function clangFormatTask(opts) {
];
logger.info(['clang-format', ...args].join(' '));

return spawn(node, [require.resolve('clang-format'), ...args], {
return spawnShell(node, [require.resolve('clang-format'), ...args], {
stdio: 'inherit',
});
};
}

function spawnShell(cmd, args, opts) {
// https://github.com/nodejs/node/issues/52554
return spawn(cmd, args, {...opts, shell: true});
}

0 comments on commit c0239e3

Please sign in to comment.