mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
fix: output error messages if git commands failed (#102)
This commit is contained in:
parent
2a98af341c
commit
62f671dcd0
1 changed files with 10 additions and 2 deletions
|
@ -37,8 +37,16 @@ function getRepoInfo() {
|
|||
|
||||
const spawnGitCommand = pify((args, cb) => {
|
||||
const git = spawn('git', args)
|
||||
git.stderr.on('data', cb)
|
||||
git.on('close', cb)
|
||||
const bufs = [];
|
||||
git.stderr.on('data', (buf) => bufs.push(buf));
|
||||
git.on('close', (code) => {
|
||||
if (code) {
|
||||
const msg = Buffer.concat(bufs).toString() || `git ${args.join('')} - exit code: ${code}`;
|
||||
cb(new Error(msg));
|
||||
} else {
|
||||
cb(null);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function commit(options, data) {
|
||||
|
|
Loading…
Reference in a new issue