diff --git a/index.js b/index.js index db02447..6860f9c 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,12 @@ const PREFIX_TEXT = Symbol('prefixText'); const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code +const terminalSupportsUnicode = () => ( + process.platform !== 'win32' || + process.env.TERM_PROGRAM === 'vscode' || + Boolean(process.env.WT_SESSION) +); + class StdinDiscarder { constructor() { this.requests = 0; @@ -163,7 +169,7 @@ class Ora { } this._spinner = spinner; - } else if (process.platform === 'win32') { + } else if (!terminalSupportsUnicode()) { this._spinner = cliSpinners.line; } else if (spinner === undefined) { // Set default spinner