mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(node): spawnSync
's status
was incorrect (#21359)
The exit code wasn't hooked up properly.
This commit is contained in:
parent
d65a297943
commit
d4ef471744
3 changed files with 12 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
|||
// Taken from Node 18.8.0
|
||||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
||||
|
||||
// TODO(cjihrig): 'run -A require.ts' should not be needed in
|
||||
// TODO(cjihrig): 'run -A runner.ts' should not be needed in
|
||||
// execSync() call at the bottom of this test.
|
||||
|
||||
'use strict';
|
||||
|
@ -49,4 +49,4 @@ setTimeout(() => {
|
|||
}, 100);
|
||||
`);
|
||||
|
||||
execSync(`${process.argv[0]} run -A require.ts ${tmpJsFile} < ${tmpCmdFile}`);
|
||||
execSync(`${process.argv[0]} run -A runner.ts ${tmpJsFile} < ${tmpCmdFile}`);
|
||||
|
|
|
@ -722,3 +722,12 @@ Deno.test(function spawnSyncStdioUndefined() {
|
|||
assertEquals(ret.stdout.toString("utf-8").trim(), "hello");
|
||||
assertEquals(ret.stderr.toString("utf-8").trim(), "world");
|
||||
});
|
||||
|
||||
Deno.test(function spawnSyncExitNonZero() {
|
||||
const ret = spawnSync(
|
||||
`"${Deno.execPath()}" eval "Deno.exit(22)"`,
|
||||
{ shell: true },
|
||||
);
|
||||
|
||||
assertEquals(ret.status, 22);
|
||||
});
|
||||
|
|
|
@ -855,7 +855,7 @@ export function spawnSync(
|
|||
windowsRawArguments: windowsVerbatimArguments,
|
||||
}).outputSync();
|
||||
|
||||
const status = output.signal ? null : 0;
|
||||
const status = output.signal ? null : output.code;
|
||||
let stdout = parseSpawnSyncOutputStreams(output, "stdout");
|
||||
let stderr = parseSpawnSyncOutputStreams(output, "stderr");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue