4

Using Grunt to build, add, commit and push my code up to Heroku.

Build, add and commit are working great.

When I specify to "git push heroku master" in grunt shell I get no stdout while the process runs.

Here is the code in Grunt.js:

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

But I am only seeing the following when the process runs:

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

I would like to see the output of the push while the push is in process.

Anyway to do this?

Update: Full grunt shell script

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

Final Grunt Shell (working):

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'}
        }
    }
}
Lowkase
  • 5,631
  • 2
  • 30
  • 48

1 Answers1

2

See:

How to make git diff write to stdout?

Adding --no-pager as an option, gives output.

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

Also, certain git commands write to stderr,as discussed here:

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

By including the flag and capturing stderr in the grunt task I was able to get output for the last part of the heroku push process (but not the part where the upload is tracked):

Fetching repository, done.

-----> Node.js app detected

       PRO TIP: Specify a node version in package.json
       See https://devcenter.heroku.com/articles/nodejs-support
Community
  • 1
  • 1
Robert Moskal
  • 21,737
  • 8
  • 62
  • 86