Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var node;
- var gulp = require('gulp');
- var spawn = require('child_process').spawn;
- var JS_SERVER_BIN_FILE = './bin/server.js';
- var JS_SERVER_SOURCE = './js/server/**/*.js';
- gulp.task('supervise', function() {
- gulp.watch(JS_SERVER_SOURCE, function() {
- if (node) node.kill();
- node = spawn('node', [JS_SERVER_BIN_FILE], {stdio: 'inherit'});
- node.on('close', function (code) {
- if (code === 8) {
- console.log('Error detected, waiting for changes...');
- }
- });
- });
- });
- process.on('exit', function() {
- if (node) node.kill()
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement