Skip to content

Commit

Permalink
fix(git-utils): handle extra error output
Browse files Browse the repository at this point in the history
  • Loading branch information
JGAntunes committed Aug 12, 2021
1 parent aae1d67 commit 5847e21
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/git-utils/src/exec.js
Expand Up @@ -9,8 +9,15 @@ const pathExists = require('path-exists')
// Fires the `git` binary. Memoized.
const mGit = function (args, cwd) {
const cwdA = safeGetCwd(cwd)
const { stdout } = execa.sync('git', args, { cwd: cwdA })
return stdout
// The child process `error.message` includes stderr and stdout output which most of the times contains duplicate
// information. We rely on `error.shortMessage` instead.
try {
const { stdout } = execa.sync('git', args, { cwd: cwdA })
return stdout
} catch (error) {
error.message = error.shortMessage
throw error
}
}

// eslint-disable-next-line no-magic-numbers
Expand Down

0 comments on commit 5847e21

Please sign in to comment.