File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var util = require('util'),
12
12
events = require ( 'events' ) ,
13
13
spawn = require ( 'child_process' ) . spawn ,
14
14
winston = require ( 'winston' ) ,
15
+ watch = require ( 'watch' ) ,
15
16
forever = require ( '../forever' ) ;
16
17
17
18
//
@@ -364,6 +365,21 @@ Monitor.prototype.kill = function (forceStop) {
364
365
return this ;
365
366
} ;
366
367
368
+ //
369
+ // ### function watch ()
370
+ // Starts watching directory tree for changes.
371
+ //
372
+ Monitor . prototype . watch = function ( ) {
373
+ var self = this ;
374
+
375
+ watch . createMonitor ( process . cwd ( ) , { ignoreDotFiles : true } , function ( monitor ) {
376
+ monitor . on ( 'changed' , function ( f , curr , prev ) {
377
+ self . info ( 'restaring script because ' + f + ' changed' ) ;
378
+ self . restart ( ) ;
379
+ } ) ;
380
+ } ) ;
381
+ }
382
+
367
383
//
368
384
// ### @private function _getEnv ()
369
385
// Returns the environment variables that should be passed along
You can’t perform that action at this time.
0 commit comments