Skip to content

Commit

Permalink
add daemon mode crash check
Browse files Browse the repository at this point in the history
  • Loading branch information
josephshen committed Jul 18, 2017
1 parent 78336f0 commit 13a1b05
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions demo/Electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ function bind_color_picker_callbacks(the_process) {

the_process.on('close', function (code) {
console.log('ColorPicker Exit ' + code);
});

the_process.stdout.on('end', function () {
console.log('ColorPicker STDOUT Done');
if( code == 0 ){
return;
}
// crashed!!!
console.log('ColorPicker Crashed!! Reload the process');
color_picker_child_process = child_process.spawn(color_picker_path, ['--daemon'])
console.log("ColorPicker PID: " + color_picker_child_process.pid)
bind_color_picker_callbacks(color_picker_child_process)
});
}

color_picker_child_process = child_process.spawn(color_picker_path, ['--daemon'])
console.log("ColorPicker PID: " + color_picker_child_process.pid)

bind_color_picker_callbacks(color_picker_child_process)

/** ****/
Expand Down

0 comments on commit 13a1b05

Please sign in to comment.