Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nice spinner on VSCode's terminal and Windows Terminal #167

Merged
merged 4 commits into from Jan 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down