首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Grunt Shell + Heroku Push = No stdout

Grunt Shell + Heroku Push = No stdout
EN

Stack Overflow用户
提问于 2013-10-22 19:19:45
回答 1查看 492关注 0票数 4

使用Grunt构建、添加、提交并将我的代码推到Heroku。

构建、添加和提交都非常有效。

当我指定为"git推送heroku主“时,当进程运行时,我不会得到stdout。

下面是Grunt.js中的代码:

代码语言:javascript
运行
复制
'git-push':             {
    command: 'git push heroku master',
    options: {
                failOnError: true,
                stdout: true,
                execOptions: { cwd: '../deploy'}
             }
}

但是,只有在进程进行时,我才能看到以下情况:

代码语言:javascript
运行
复制
$ grunt push
Running "shell:git-push" (shell) task
Done, without errors.

我希望在推送过程中看到推送的输出。

总之要这么做?

更新:完整的外壳脚本

代码语言:javascript
运行
复制
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 (工作):

代码语言:javascript
运行
复制
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'}
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-20 23:16:15

请参见:

How to make git diff write to stdout?

添加--无寻呼机作为选项,提供输出。

代码语言:javascript
运行
复制
git --no-pager <subcommand> <options>

另外,某些git命令会写到stderr,如下所述:

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

通过在grunt任务中包含标志和捕获stderr,我能够为heroku推送过程的最后一部分(但不是跟踪上传的部分)获得输出:

代码语言:javascript
运行
复制
Fetching repository, done.

-----> Node.js app detected

       PRO TIP: Specify a node version in package.json
       See https://devcenter.heroku.com/articles/nodejs-support
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19526445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档