Skip to content

Commit

Permalink
Merge pull request #200 from zazuko/restore-stderr
Browse files Browse the repository at this point in the history
fix: restore log to stderr
  • Loading branch information
giacomociti authored Nov 9, 2023
2 parents 1891143 + 0e5cb97 commit 400c739
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-plums-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"barnard59": patch
---

Write CLI errors to `stderr`
4 changes: 2 additions & 2 deletions packages/cli/bin/barnard59.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const onError = async err => {
if (err instanceof MultipleRootsError) {
const alternatives = err.alternatives.map(x => `\n\t--pipeline ${x}`).join('')
// eslint-disable-next-line no-console
console.log(`Multiple root pipelines found. Try one of these:${alternatives}`)
console.error(`Multiple root pipelines found. Try one of these:${alternatives}`)
} else {
// eslint-disable-next-line no-console
console.log(err)
console.error(err)
}
}
await sdk.shutdown()
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/barnard59.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('barnard59', function () {
const result = shell.exec(command, { silent: true, cwd })

strictEqual(result.code, 1)
expect(result.stdout).to.equal('Multiple root pipelines found. Try one of these:\n\t--pipeline http://example.org/pipeline/p1\n\t--pipeline http://example.org/pipeline/p2\n')
expect(result.stderr).to.equal('Multiple root pipelines found. Try one of these:\n\t--pipeline http://example.org/pipeline/p1\n\t--pipeline http://example.org/pipeline/p2\n')
})
it('should exit with error code 0 if there are no error while processing the pipeline', () => {
const pipelineFile = filenamePipelineDefinition('simple')
Expand Down

0 comments on commit 400c739

Please sign in to comment.