Skip to content

Commit 659aa8a

Browse files
committed
Fix concurrently error handling
1 parent 390ed62 commit 659aa8a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/webpack-test.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,22 @@ const startSampleAndRun = async () => {
155155
})
156156
.catch((exitInfos) => {
157157
// Concurrently throws SIGTERM with exit code 0 on success, check code and exit with it
158-
const { exitCode } = exitInfos[0];
159-
process.exit(exitCode);
158+
if (Array.isArray(exitInfos)) {
159+
// If it's an array of exit infos
160+
const exitInfo = exitInfos[0];
161+
if (exitInfo?.signal === 'SIGTERM') {
162+
process.exit(0);
163+
}
164+
const exitCode = exitInfo?.exitCode ?? 1;
165+
process.exit(exitCode);
166+
} else {
167+
// If it's a single error object
168+
if (exitInfos?.signal === 'SIGTERM') {
169+
process.exit(0);
170+
}
171+
const exitCode = exitInfos?.exitCode ?? 1;
172+
process.exit(exitCode);
173+
}
160174
});
161175
};
162176

0 commit comments

Comments
 (0)