使用Grunt构建,添加,提交和推送我的代码到Heroku.
构建,添加和提交都很有效.
当我在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.
我希望在推送过程中看到推送的输出.
无论如何要做到这一点?
更新:完整的grunt 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'}
}
}
}
最终的Grunt Shell(工作):
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'}
}
}
}
最佳答案 看到:
How to make git diff write to stdout?
添加–no-pager作为选项,提供输出.
git --no-pager <subcommand> <options>
此外,某些git命令会写入stderr,如下所述:
http://git.661346.n2.nabble.com/git-push-output-goes-into-stderr-td6758028.html
通过在grunt任务中包含标志和捕获stderr,我能够获得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