From 3193fa5e0224ee31d1e8a406bae527119ebf677e Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 2 Nov 2020 13:00:47 -0500 Subject: [PATCH] Spinner should respect errorStream option `ora` accepts an optional `stream` argument. It defaults to stderr. If the user has provided an alternative to `stderr` via `options.errorStream`, the spinner should follow that too. --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index c2866a0..d30e5df 100644 --- a/lib/index.js +++ b/lib/index.js @@ -32,8 +32,9 @@ const DEFAULT_WRITE_LEVEL = 'INFO'; */ class UI { constructor(_options) { - let spinner = this.spinner = ora({ color: 'green' }); let options = _options || {}; + let errorStream = this.errorStream = options.errorStream || process.stderr; + let spinner = this.spinner = ora({ color: 'green', stream: errorStream }); // Output stream this.progress = false; this.actualOutputStream = options.outputStream || process.stdout; @@ -51,7 +52,6 @@ class UI { this.outputStream.setMaxListeners(0); this.outputStream.pipe(this.actualOutputStream); this.inputStream = options.inputStream || process.stdin; - this.errorStream = options.errorStream || process.stderr; this.errorLog = options.errorLog || []; this.writeLevel = options.writeLevel || DEFAULT_WRITE_LEVEL; this.errorReport = null;