-
Notifications
You must be signed in to change notification settings - Fork 280
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
Always read user input from /dev/tty #396
Comments
We already use /dev/tty, this one is not supported for windows of course. There we use winapi. Crossterm can be used through a pipe, please see this example for a demo. |
@TimonPost Not sure if I understand correctly. I believe the example shows how to write to For example, expecting the following example to work:
|
I've tried to always use /dev/tty here: /// Creates a file descriptor pointing to the standard input or `/dev/tty`.
pub fn tty_fd() -> Result<FileDesc> {
let (fd, close_on_drop) = (
fs::OpenOptions::new()
.read(true)
.write(true)
.open("/dev/tty")?
.into_raw_fd(),
true,
);
Ok(FileDesc::new(fd, close_on_drop))
} But doesn't seem to fix the issue. Any idea why it might not detect an IOCTL device while using a pipe ? |
In fact, this resulted in an error for ITerm terminals. #404. On Linux, it seems to behave just fine, but on macos no input can be read anymore. |
@TimonPost Just to make sure, were (Disclaimer: I haven't checked the solution) |
Ah, no they did not, I will open a branch with those changes. If someone can validate the working on mac os we can merge it. |
@TimonPost I can test it on Mac, let me know |
Can someone try this branch on mac os: #407 |
@TimonPost - I can give it a try. Is there something in particular that needs testing? |
@TimonPost I noticed with the latest master that #406 is fixed but I do still see the issue that @lotabout mentions in the comment above:
|
Yea, there is someplace some argument is given, I supposed to libc, which is invalid. I haven't found that place yet. Regarding @Iotabout his comment, his ideas are implemented by this PR. |
I ran into this issue in the tab terminal multiplexer. I was trying to add support for stdin input in a raw mode app:
I hit the same error as described above. |
This will allow for the REPL to be used on Windows, but has the side-effect of making the REPL untestable via stdin, due to crossterm-rs/crossterm#396 I haven't run into a failing test here in recent times except for occasionally leaving in some debug output, which has been caught a few times. I'll add a specific test for ensuring trace isn't left in later in the branch.
This will allow for the REPL to be used on Windows, but has the side-effect of making the REPL untestable via stdin, due to crossterm-rs/crossterm#396
This will allow for the REPL to be used on Windows, but has the side-effect of making the REPL untestable via stdin, due to crossterm-rs/crossterm#396
This will allow for the REPL to be used on Windows, but has the side-effect of making the REPL untestable via stdin, due to crossterm-rs/crossterm#396
This will allow for the REPL to be used on Windows, but has the side-effect of making the REPL untestable via stdin, due to crossterm-rs/crossterm#396
Is your feature request related to a problem? Please describe.
I'm trying to port my CLI util skim to crossterm for windows support. And one of the use cases of skim is to accept piped input:
In this case the
stdin
do not generate user inputs while I still hope the user inputs are handled correctly.Describe the solution you'd like
When creating file descriptor, use
/dev/tty
all the time.The text was updated successfully, but these errors were encountered: