Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: only flush stdout when no error
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed May 13, 2018
1 parent 9b34078 commit ed0f5b7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export default abstract class Command {
delete process.env[this.config.scopedEnvVarKey('REDIRECTED')]

await this.init()
return await this.run()
const retVal = await this.run()
try {
const {ux} = require('cli-ux')
await ux.flush()
} catch {}
return retVal
} catch (e) {
err = e
await this.catch(e)
Expand Down Expand Up @@ -118,10 +123,6 @@ export default abstract class Command {
protected async finally(_: Error | undefined) {
try {
await require('@oclif/errors').config.errorLogger.flush()
try {
const {ux} = require('cli-ux')
await ux.flush()
} catch {}
// tslint:disable-next-line no-console
} catch (err) { console.error(err) }
}
Expand Down

0 comments on commit ed0f5b7

Please sign in to comment.