Skip to content

Commit

Permalink
chore: improve our comments on execa's error.shortMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
JGAntunes committed Aug 12, 2021
1 parent e4ce3ec commit 75fbf28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/build/src/plugins_core/build_command.js
Expand Up @@ -38,8 +38,9 @@ const coreCommand = async function ({
handleBuildCommandOutput(buildCommandOutput, logs)
return {}
} catch (error) {
// The child process `error.message` includes stderr and stdout output which most of the times contains duplicate
// information. We rely on `error.shortMessage` instead.
// In our test environment we use `stdio: 'pipe'` on the build command, meaning our `stdout/stderr` output are
// buffered and consequently added to `error.message`. To avoid this and end up with duplicated output in our
// logs/snapshots we need to rely on `error.shortMessage`.
error.message = error.shortMessage
handleBuildCommandOutput(error, logs)
addErrorInfo(error, { type: 'buildCommand', location: { buildCommand, buildCommandOrigin, configPath } })
Expand Down
4 changes: 2 additions & 2 deletions packages/git-utils/src/exec.js
Expand Up @@ -9,12 +9,12 @@ const pathExists = require('path-exists')
// Fires the `git` binary. Memoized.
const mGit = function (args, cwd) {
const cwdA = safeGetCwd(cwd)
// 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) {
// The child process `error.message` includes stderr and stdout output which most of the times contains duplicate
// information. We rely on `error.shortMessage` instead.
error.message = error.shortMessage
throw error
}
Expand Down

0 comments on commit 75fbf28

Please sign in to comment.