Coffeescript grunt.util.spawn不';不出声

Coffeescript grunt.util.spawn不';不出声,coffeescript,gruntjs,Coffeescript,Gruntjs,Grunt.util.spawn未调用done函数。这是代码。当从命令提示符执行命令时,该命令失败并抛出一条错误消息,但gruntjs中未捕获该消息。发生了什么 module.exports = (grunt)-> grunt.initConfig concurrent: dev: ['watch'] slim: dev: expand: true src: 'views'

Grunt.util.spawn未调用done函数。这是代码。当从命令提示符执行命令时,该命令失败并抛出一条错误消息,但gruntjs中未捕获该消息。发生了什么

module.exports = (grunt)->
grunt.initConfig
    concurrent:
        dev: ['watch']
    slim:
        dev:
            expand: true
            src:  'views'
            dest: 'views/'
    watch:
        slim:
            files: 'views/**.slim'
            tasks:['slim']

grunt.registerMultiTask 'slim', 'Server Slim Compiler', ->
    console.log 'In the slim'
    options = {}
    options.cmd = 'dirld'
    options.grunt = true
    console.log options
    grunt.util.spawn options, (err,res,cod)->
        console.log 'in the spawn'
        if err
            grunt.log.error err
        else
            grunt.log.oklns 'success'
            grunt.log.writeln res

grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-concurrent'
grunt.registerTask 'default', ['concurrent:dev']

grunt.util.spawn
是异步的,因此您需要使
slim
任务异步。见:


谢谢你。在我的生活手册中找不到这个。
grunt.registerMultiTask 'slim', 'Server Slim Compiler', ->
  done = @async()
  grunt.util.spawn options, (err,res,cod) ->
    done() # Im done, continue onto the next task