方法'EXEC'不咕噜工作任务 [英] Method 'exec' doesn't work in grunt task

查看:144
本文介绍了方法'EXEC'不咕噜工作任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在繁重的配置registred任务:

I have a task that registred in grunt config:

grunt.registerTask('test_Branches',          'Run Branches check on windows',       require('PATH').check);

在我branches.test.js我有方法检查():

And in my branches.test.js I have method check():

this.check = function () {
'use strict';
console.log("Execution started\n");
        exec('git for-each-ref --sort=-committerdate refs/remotes/origin/  --format='%(committername)', {cwd: currentDir}, function (error, stdout, stderr) {
            console.log('started 1.1');
            if (stderr) {
                console.log('stderr: ' + stderr + "\n");
            }
            else {
                console.log("Authors has been received\n");
            }
            if (error !== null) {
                console.log('Execution command error: ' + error + "\n");
            }
        });

};

但是,当我试图通过与命令的命令行来执行我的任务:

But when I'm trying to execute my task through command line with command:

grunt test_Branches

我:

C:\PATH>grunt test_Branches
Running "test_Branches" task
Execution started
Done, without errors.

什么是我的'EXEC'方法的问题?

What's the problem with my 'exec' method?

推荐答案

有关这个问题的解决方案是使用 grunt.task.current.async(); 异步功能。正如乔纳森Lonowski提到,这里你可以找到详细信息。

The solution for this problem is using grunt.task.current.async(); for asynchronous functions. As Jonathan Lonowski mentioned, here you can find details.

这篇关于方法'EXEC'不咕噜工作任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆