2014-07-08 10 views
0

나는 툴툴 거리는 소리 설정에서 registred 작업이 있습니다 방법 '간부는'고된 작업에서 작동하지 않습니다

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

그리고 내 branches.test.js에서

나는이 방법을 체크() :

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"); 
      } 
     }); 

}; 
을 내가 명령을 사용하여 명령 줄을 통해 내 작업을 실행하기 위해 노력하고있어 때

는하지만 :

grunt test_Branches 

내가 가지고 :

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

내 'exec'방법의 문제점은 무엇입니까?

+1

해결책을 찾은 것 같습니다. 비동기 함수로'grunt.task.current.async(); '를 사용할 필요가있다. 그래서 나도 그랬어! –

+0

"[* 왜 내 비동기 작업이 완료되지 않습니까? *] (http://gruntjs.com/creating-tasks#why-doesn-t-my-asynchronous-task-complete)" –

+0

네, 고마워요. 조나단. 불행히도, 나는 그 일에 대해 몰랐고 해결책을 찾는데 2 일을 낭비했다. ( –

답변

0

이 문제에 대한 해결책은 비동기 함수에 grunt.task.current.async();을 사용하고 있습니다. Jonathan Lonowski가 말했듯이, here 세부 사항을 찾을 수 있습니다.

관련 문제