-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
fixes #58 detect non interactive terminals #83
fixes #58 detect non interactive terminals #83
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great! But tests are needed.
I'm having second thoughts on this implementation.
So I plan to check both PS: should we add an option to force interactivity to support tools like expect? |
e3daed8
to
c668d55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few more comments to the implementation 🙂
Maybe, we can implement our own function that checks different terminal emulators? If it's Posix, check the value of $-
, if it's minTTY, check something else, and do something else for PowerShell or cygwin.
Maybe we can also check what ghcup
does and how they handle cross-platform support?
@marcellourbani The fixes look great 👍🏻
I'm not an expert on the first one. So I don't have a strong opinion on this. We can go with the simplest reasonable option for now and change later when it's not enough. Nobody pays me to support exotic shells. So if the standard library doesn't have an out-of-the-box cross-platform solution, what can I do 🤷🏻 I agree that the
As for the second one, let's check only I believe, I confused So, a simple solution would be to just run |
What about letting the user override? data RequestedInteractiveMode
= RInteractive
| RNonInteractive
| RAutoDetect
data InteractiveMode
= Interactive
| NonInteractive
handleInteractiveMode :: RequestedInteractiveMode -> IO InteractiveMode or simply: handleInteractiveMode :: Maybe RequestedInteractiveMode -> IO InteractiveMode so by default we autodetect, but users can force either way |
@marcellourbani Overriding interactivity is something I'd like to avoid. We can't output interactive info in a non-interactive terminal so it doesn't make sense. Also, there's no appropriate CLI flag for that and since it's a global default, I'd like to avoid polluting global namespace with non-standard flags. I'm happy to accept support of exotic shells like minTTY and Cygwin. So, if you want to work on supporting and testing them, feel free to continue working on this issue and taking as much time as you want 🤗 I was mostly implying that the changes might be unreliable without the ability to test this on CI, so the support will be potentially fragile. And if someone wants to contribute the support of these shells and verify that it works for them, I'm happy to accept this change! But I personally don't have the capacity for that. And I wouldn't ask contributors to do such huge work either 🙏🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the implementation and so insightful conversation! 🙏🏻
…minals-automatically
Thank you for the mentoring! |
No description provided.