Skip to content

Commit

Permalink
accelerator-dev: restart accelerator on crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Jun 16, 2016
1 parent a457acc commit 7e27ddc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions accelerator/src/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const projRoot='/home/dragon/www/meteor-hmr/demo';

const debug=process.env.HOT_DEBUG || 1;
const files = recursive('src');
console.log('Dev mode. Watching: ', files.join(', '));
console.log('Dev mode. Watching: ' + files.join(', ') + '\n');

// Add CWD to lib/accelerator, since we give a new CWD for the cmd
args[0] = path.join(process.cwd(), args[0]);

var child;
var child, restarting = false;
const restart = _.debounce(function restart() {
if (child)
child.kill();
Expand All @@ -39,7 +39,16 @@ function start() {
cwd: projRoot,
env: { HOT_DEBUG: debug },
stdio: [0,1,2]
});
});
restarting = true;

child.on('exit', () => {
if (restarting)
return;

console.log("\n\nAccelerator exited/crashed, restarting...\n");
start();
});
}

start();

0 comments on commit 7e27ddc

Please sign in to comment.