git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

require('child_process').exec('git summary')

Open zxdong262 opened this issue 10 years ago • 2 comments

get nothing, but require('child_process').exec('git summary --line') will get the right stdout.

var exec = require('child_process').exec
exec('git summary', function(err, stdout) {
    //nothing in here works
})

exec('git summary --line', function(err, stdout) {
    //works fine
    assert(stdout)
})

When I try use node to get the stdout from git summary, I find this strange thing, do not know why. I hope it can be fixed. Thanks.

zxdong262 avatar Apr 11 '15 15:04 zxdong262

hmm?

hemanth avatar Apr 11 '15 15:04 hemanth

I just wrote some code to reproduce it:

var exec = require('child_process').exec
exec('git summary', function(err, stdout) {
    console.log(stdout);
})

Got nothing.

However,

exec "git summary" if fork.nil? # ruby code

This time it output correct result.

So, I guess it is not a bug of git-extras. @zxdong262 Maybe you need to dive into child_process?

spacewander avatar Sep 07 '15 16:09 spacewander