Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 71be91c

Browse files
alan-agius4vikerman
authored andcommitted
fix(builders): error when process is closed with non zero error code (#1403)
1 parent 7e25548 commit 71be91c

File tree

1 file changed

+7
-6
lines changed
  • modules/builders/src/ssr-dev-server

1 file changed

+7
-6
lines changed

modules/builders/src/ssr-dev-server/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ export function spawnAsObservable(
3232
): Observable<{ stdout?: string, stderr?: string }> {
3333
return new Observable(obs => {
3434
const proc = spawn(command, args, options);
35-
if (!proc) {
36-
obs.error(new Error(`${command} cannot be spawned.`));
37-
return;
38-
}
39-
4035
if (proc.stdout) {
4136
proc.stdout.on('data', data => obs.next({ stdout: data.toString() }));
4237
}
@@ -47,7 +42,13 @@ export function spawnAsObservable(
4742

4843
proc
4944
.on('error', err => obs.error(err))
50-
.on('close', () => obs.complete());
45+
.on('close', code => {
46+
if (code !== 0) {
47+
obs.error(new Error(`${command} exited with ${code} code.`));
48+
}
49+
50+
obs.complete();
51+
});
5152

5253
return () => {
5354
if (!proc.killed) {

0 commit comments

Comments
 (0)