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

Skip TTY checks #109

Merged
merged 2 commits into from
Feb 3, 2023
Merged

Skip TTY checks #109

merged 2 commits into from
Feb 3, 2023

Conversation

aymanbagabas
Copy link
Collaborator

Add WithUnsafe options to skip checking for TTY and running IoCtl commands.
This is useful for mocking console output and querying the terminal over SSH.

Fixes: #105 & #108

output.go Outdated Show resolved Hide resolved
This disables any TTY checks including IOCTL and unix calls.
Useful for mocking console output and querying the terminal over SSH.
@muesli muesli added the enhancement New feature or request label Feb 3, 2023
@muesli muesli merged commit 0822a5c into master Feb 3, 2023
@muesli muesli deleted the unsafe branch February 3, 2023 20:33
@heaths
Copy link

heaths commented Feb 3, 2023

This works, but seems like sledgehammer to drive a thumbtack. Something like #108 is specific to the original issue in #105. This seems to be intended to just disable everything and isn't intuitive. How would one make the leap from "unsafe" to "tty" support?

@muesli
Copy link
Owner

muesli commented Feb 6, 2023

I think we want both options, actually. I'm curious, what's your use-case for #108?

@heaths
Copy link

heaths commented Feb 6, 2023

It's for tests. I've written a console module I use in various projects and much of it - or its direct dependencies - are based on termenv. The main purpose of that module is being able to test different output for CLIs, mainly for regression tests. I'd like to replace much of what I have rewritten myself with termenv (since it's already a common dependency), but being able to simulate TTY is critical to making that happen.

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

Successfully merging this pull request may close these issues.

Allow effectively overriding isTTY for mocking console output
3 participants