Skip to content

Commit fb79a37

Browse files
author
Andrei Canta
committed
Forward child's exit code to main process
1 parent 39239cd commit fb79a37

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ChildProcess } from 'child_process';
2+
13
import { StackConfig, StackManager } from 'stacker-core';
24

35
export function getStackConfig(path = process.cwd()) {
@@ -15,7 +17,11 @@ export async function getStackManager(path = process.cwd()) {
1517
export function catchErrors(handle) {
1618
return async function (args, options, logger) {
1719
try {
18-
await handle(args, options, logger);
20+
const result = await handle(args, options, logger);
21+
22+
if (result instanceof ChildProcess) {
23+
result.on('exit', code => process.exit(code));
24+
}
1925
} catch (error) {
2026
logger.error(error.message);
2127
}

0 commit comments

Comments
 (0)