Grunt Shell + Heroku Push =没有标准输出

时间:2013-10-22 19:19:46

标签: heroku gruntjs

使用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'}
        }
    }
}

1 个答案:

答案 0 :(得分:2)

请参阅:

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
相关问题