mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 05:56: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 spawnGitCommand = pify((args, cb) => {
|
||||||
const git = spawn('git', args)
|
const git = spawn('git', args)
|
||||||
git.stderr.on('data', cb)
|
const bufs = [];
|
||||||
git.on('close', cb)
|
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) {
|
function commit(options, data) {
|
||||||
|
|
Loading…
Reference in a new issue