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

Do not set the terminal to raw mode if it isn't actually a terminal #19

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

aykevl
Copy link
Contributor

@aykevl aykevl commented Jul 28, 2023

It doesn't make sense to try to set a terminal as a raw terminal if it isn't actually a terminal. Worse, this may break tests that assume they can simply provide a pipe to a subprocess and expect the terminal will be unchanged.

See this PR, which needs this patch:
sharkdp/bat#2631


Note that this requires Rust 1.70 for the IsTerminal trait, if that's too new I can switch this PR to use the is-terminal crate instead.
https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#isterminal

@aykevl
Copy link
Contributor Author

aykevl commented Nov 23, 2023

@dalance can you take a look at this PR?

@dalance
Copy link
Owner

dalance commented Nov 24, 2023

@aykevl Sorry for the late reply. I missed this PR.
I want to keep minimum Rust version under 1.70, so could you change to use the is-terminal crate instead?
If so, I'll merge and release as soon as possible.

It doesn't make sense to try to set a terminal as a raw terminal if it
isn't actually a terminal. Worse, this may break tests that assume they
can simply provide a pipe to a subprocess and expect the terminal will
be unchanged.

See this PR, which needs this patch:
sharkdp/bat#2631
@aykevl aykevl force-pushed the fix-xterm-nonterminal branch from 1307875 to cfbb47e Compare December 5, 2023 12:45
@aykevl
Copy link
Contributor Author

aykevl commented Dec 5, 2023

I've updated the PR! I've tested the PR with Rust 1.69, but according to the is-terminal crate it should work with Rust down to version 1.63.

Also I ran cargo fmt.

@dalance dalance merged commit 5fbcf07 into dalance:master Dec 6, 2023
@dalance
Copy link
Owner

dalance commented Dec 6, 2023

Thanks!
I've released v0.4.4.

@aykevl aykevl deleted the fix-xterm-nonterminal branch December 7, 2023 15:47
@aykevl
Copy link
Contributor Author

aykevl commented Dec 7, 2023

That was my first Rust PR :) I'll be using it in bat.

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.

2 participants