在未处理的exception之后安全地重新启动nodemon

我正在使用gulp并从任务运行nodemon。 每次它检测到它的变化

  • 重新启动服务器
  • 运行“构build”任务

是这样的顺序。 在nodemon重新启动之前,无法知道如何踢“构build”任务(设置delay参数无效)。

 nodemon = require "gulp-nodemon" runSequence = require 'run-sequence' # couldn't figure out how to run gulp task # from another task, so ended up using this nodemon( script:'server.js' watch: 'src/**/*.*' ).on "restart" (files)-> runSequence "build" 

现在,我的问题是 – 当构build过程中发生某些事情时,我显然无法控制(比如说Jade文件无法编译),进程会抛出uncaughtExceptionexception并崩溃。 我需要什么,重新启动nodemon,并不断尝试build设,直到失败的玉文件修复。

我尝试过运行“build”,在process.on 'uncaughtException'使用nodemon,它有点用,但是nodemon停止监视文件,不能再识别变化。

你们可以build议吗?