pass 'detached:true' for diff tool (#56293)

This commit is contained in:
Ron Buckton 2023-11-03 11:18:21 -04:00 committed by GitHub
parent 6a9bc38da8
commit e1ef69d99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@ export async function exec(cmd, args, options = {}) {
const { ignoreExitCode, waitForExit = true, ignoreStdout } = options;
if (!options.hidePrompt) console.log(`> ${chalk.green(cmd)} ${args.join(" ")}`);
const proc = spawn(which.sync(cmd), args, { stdio: waitForExit ? ignoreStdout ? ["inherit", "ignore", "inherit"] : "inherit" : "ignore" });
const proc = spawn(which.sync(cmd), args, { stdio: waitForExit ? ignoreStdout ? ["inherit", "ignore", "inherit"] : "inherit" : "ignore", detached: !waitForExit });
if (waitForExit) {
const onCanceled = () => {
proc.kill();
@ -52,8 +52,7 @@ export async function exec(cmd, args, options = {}) {
}
else {
proc.unref();
// wait a short period in order to allow the process to start successfully before Node exits.
setTimeout(() => resolve({ exitCode: undefined }), 100);
resolve({ exitCode: undefined });
}
}));
}