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

fix: Detect tty for prqlc prompt #3240

Merged
merged 3 commits into from
Aug 3, 2023
Merged

fix: Detect tty for prqlc prompt #3240

merged 3 commits into from
Aug 3, 2023

Conversation

max-sixty
Copy link
Member

Closes #3228

@max-sixty
Copy link
Member Author

FYI @aj-bagwell — not sure if this is a helpful @ or not — feel free to ignore if not.

The approach in https://github.com/PRQL/prql/pull/2885/files#diff-5042ecb23fbc2e8750e6452e008e9e96007bc06be4dff012653aedeaede02865R410 didn't seem to detect a tty correctly (or at least how I'm thinking about a TTY, where someone is typing into stdin, rather than piping text in).

More details in #3228. I spent 20 minutes looking through dependencies — it seems like clio is calling the same code, though the code changes slightly by versions, so I'm likely missing something.

We're v happy to stick with this for a bit while upgrades percolate through the ecosystem.

@max-sixty max-sixty enabled auto-merge (squash) August 3, 2023 22:48
Copy link
Member

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!
Could we add a test for this?

@max-sixty max-sixty merged commit 74097d3 into PRQL:main Aug 3, 2023
89 of 90 checks passed
@max-sixty max-sixty deleted the prompt branch August 3, 2023 23:13
@max-sixty
Copy link
Member Author

Thanks for working on this! Could we add a test for this?

For sure we should have one — but it should be in our tests already! e.g.

let mut cmd = StdinCommand::new(get_cargo_bin("prqlc"), "from tracks");

I think possibly it isn't picking it up because it's not a terminal, whereas the error was happening while we were in a terminal but not a tty? (I'm not tight on these concepts...)

@eitsupi
Copy link
Member

eitsupi commented Aug 3, 2023

Thank you for pointing that out. It seems difficult to test this....

max-sixty added a commit to max-sixty/prql that referenced this pull request Apr 29, 2024
Continuation of PRQL#3240, replacing a deprecated dependency

FYI I tried using the clio approach, but it still has the same existing issue re printing the help message even when not in a terminal.
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.

Can the prqlc prompt only show when waiting?
2 participants