Skip to content

Commit

Permalink
fix(gatsby): Silence process.send Error (#32744)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5d7831d)
  • Loading branch information
LekoArts committed Aug 9, 2021
1 parent 115e631 commit 2c48d48
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions packages/gatsby/src/commands/develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,20 @@ class ControllableScript {
if (signal) {
this.process.kill(signal)
} else {
this.process.send({
type: `COMMAND`,
action: {
type: `EXIT`,
payload: code,
this.process.send(
{
type: `COMMAND`,
action: {
type: `EXIT`,
payload: code,
},
},
})
() => {
// The try/catch won't suffice for this process.send
// So use the callback to manually catch the Error, otherwise it'll be thrown
// Ref: https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback
}
)
}
} catch (err) {
// Ignore error if process has crashed or already quit.
Expand Down

0 comments on commit 2c48d48

Please sign in to comment.