fix process not exiting problem

This commit is contained in:
2016-09-22 17:14:36 +02:00
parent 276494c8a2
commit 0fe26b4b44
2 changed files with 14 additions and 16 deletions

View File

@ -7,7 +7,7 @@ export type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlin
export class Smartchok {
watchStringmap = new Stringmap()
chokidarOptions: plugins.chokidar.WatchOptions
status: TSmartchokStatus
status: TSmartchokStatus = 'idle'
private watcher
private watchingDeferred = plugins.q.defer<void>() // used to run things when watcher is initialized
private eventObservablemap = new plugins.lik.Observablemap() // register one observable per event
@ -22,9 +22,12 @@ export class Smartchok {
*/
add(pathArrayArg: string[]) {
this.watchStringmap.addStringArray(pathArrayArg)
this.watchingDeferred.promise.then(() => {
this.watcher.add(pathArrayArg)
})
if (this.status !== 'idle') {
this.watchingDeferred.promise.then(() => {
this.watcher.add(pathArrayArg)
})
}
}
/**