Skip to content

Commit 99936a8

Browse files
fix(gatsby): catch error from this.process.send (#32356)
Co-authored-by: Ward Peeters <[email protected]>
1 parent 9f8a580 commit 99936a8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/gatsby/src/commands/develop.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,21 @@ class ControllableScript {
126126
}
127127

128128
this.isRunning = false
129-
if (signal) {
130-
try {
129+
try {
130+
if (signal) {
131131
this.process.kill(signal)
132-
} catch (err) {
133-
// Ignore error if process has crashed
134-
// Ref: https://github.com/gatsbyjs/gatsby/issues/28011#issuecomment-877302917
132+
} else {
133+
this.process.send({
134+
type: `COMMAND`,
135+
action: {
136+
type: `EXIT`,
137+
payload: code,
138+
},
139+
})
135140
}
136-
} else {
137-
this.process.send({
138-
type: `COMMAND`,
139-
action: {
140-
type: `EXIT`,
141-
payload: code,
142-
},
143-
})
141+
} catch (err) {
142+
// Ignore error if process has crashed or already quit.
143+
// Ref: https://github.com/gatsbyjs/gatsby/issues/28011#issuecomment-877302917
144144
}
145145

146146
return new Promise(resolve => {

0 commit comments

Comments
 (0)