Skip to content

Commit

Permalink
fix: error while exiting after child process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
antonfisher committed Feb 1, 2018
1 parent 1595d3f commit aaa65c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function exitProcess(err) {
if (uiLayout) {
uiLayout.destroy();
}
if (userProcess) {
if (userProcess && userProcess.process.pid) {
console.log(`Exiting subprocess, PID ${userProcess.process.pid}...`);
userProcess.kill((err) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/UserProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UserProcess extends EventEmitter {

kill(callback) {
if (this.process) {
terminate(this.process.pid, callback);
terminate(this.process.pid, (err) => callback(!err || err.code === 'ESRCH' ? null : err));
} else {
callback();
}
Expand Down

0 comments on commit aaa65c7

Please sign in to comment.