2013-10-22 27 views
4

使用Grunt構建,添加,提交併將我的代碼推送到Heroku。Grunt Shell + Heroku Push =無標準輸出

構建,添加和提交工作很好。

當我在grunt shell中指定爲「git push heroku master」時,在進程運行時我沒有得到stdout。

這裏是Grunt.js代碼:

'git-push':    { 
    command: 'git push heroku master', 
    options: { 
       failOnError: true, 
       stdout: true, 
       execOptions: { cwd: '../deploy'} 
      } 
} 

但我只看到以下時運行的過程:

$ grunt push 
Running "shell:git-push" (shell) task 
Done, without errors. 

我想看到的,而推的輸出推動正在進行中。

無論如何要做到這一點?

更新:全咕嚕shell腳本

shell: { 
    'git-add':    { 
     command: 'git --no-pager add .', 
     options: { 
      stdout: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    }, 
    'git-commit':   { 
     command: 'git --no-pager commit -m "update"', 
     options: { 
      stdout: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    }, 
    'git-push':    { 
     command: 'git --no-pager push heroku master', 
     options: { 
      failOnError: true, 
      stdout: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    } 
} 

最終咕嚕殼牌(工作):

shell: { 
    'git-add':    { 
     command: 'git --no-pager add .', 
     options: { 
      stdout: true, 
      stderr: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    }, 
    'git-commit':   { 
     command: 'git --no-pager commit -m "update"', 
     options: { 
      stdout: true, 
      stderr: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    }, 
    'git-push':    { 
     command: 'git --no-pager push heroku master', 
     options: { 
      failOnError: true, 
      stdout: true, 
      stderr: true, 
      execOptions: { cwd: '../deploy'} 
     } 
    } 
} 
+0

它看起來像我不喜歡任何git命令的標準輸出。 –

回答

2

參見:

How to make git diff write to stdout?

添加--no-pager作爲選項,給出輸出。

git --no-pager <subcommand> <options> 

而且,某些Git命令寫入標準錯誤,因爲這裏討論:

http://git.661346.n2.nabble.com/git-push-output-goes-into-stderr-td6758028.html

通過包括標誌和繁重的任務捕獲標準錯誤我能得到輸出的最後一部分的heroku推進過程(但不是上傳跟蹤的部分):

Fetching repository, done. 

-----> Node.js app detected 

     PRO TIP: Specify a node version in package.json 
     See https://devcenter.heroku.com/articles/nodejs-support 
+0

沒有影響 - 我仍然看不到推送標準輸出。我用我正在使用的全部grunt shell腳本更新了我的問題。 – Lowkase

+0

添加stderr:對選項爲true。 –

+1

令人敬畏的工作羅伯特!現在它的工作,感謝您的時間和努力。 – Lowkase