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

Don't call stream TTY methods on streams that are not TTYs #82

Merged
merged 2 commits into from
Jul 17, 2018

Conversation

gobengo
Copy link

@gobengo gobengo commented Jul 11, 2018

moveCursor, clearLine, etc are not methods that every stream will have. Only streams that are specifically TTY streams.

I think by default this.stream is set to process.stderr. In unix it's very possible for stderr to not be a TTY.

When running some node thing in the background (with concurrently), I got an exception.

index.js Outdated
@@ -77,6 +77,7 @@ class Ora {
}

for (let i = 0; i < this.linesToClear; i++) {
if ( ! this.stream.isTTY) continue;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check should be on line 75

@gobengo
Copy link
Author

gobengo commented Jul 11, 2018

@sindresorhus done.

Did it in that first place so that .linesToClear would still be reset to 0. This way it won't. just FYI. Happy to do it the way you prefer.

@gobengo
Copy link
Author

gobengo commented Jul 12, 2018

Is travis failing because of my change or something else?

@forresst
Copy link
Contributor

For travis failure, I made a PR (#84) that was merged.
Make a rebase: it should be better

@sindresorhus sindresorhus changed the title Don't call tty stream methods on streams that are not TTYs Don't call stream TTY methods on streams that are not TTYs Jul 17, 2018
@sindresorhus sindresorhus merged commit 3c24df2 into sindresorhus:master Jul 17, 2018
@forresst
Copy link
Contributor

@sindresorhus I think you were a little fast, I wanted him to make a rebase to check that everything works fine.

There is a problem with the tests. I can adapt the code for the tests to pass correctly

sindresorhus added a commit that referenced this pull request Jul 17, 2018
@sindresorhus
Copy link
Owner

@forresst Yeah, I know. I decided to just fix it myself instead of waiting. Want to get out a new release today.

@forresst
Copy link
Contributor

@sindresorhus Perfect ! (sorry for spam)

@sindresorhus
Copy link
Owner

No worries, you couldn't have known that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants