Open sorairolake opened 11 months ago
Not sure if it's related, but I have a similar problem with FuzzySelect
.
Example:
use dialoguer::FuzzySelect;
fn main() {
let options = ["abc", "def", "ghi"];
let index = FuzzySelect::new()
.with_prompt("Select")
.items(&options)
.interact().unwrap();
println!("selected: {}", options[index]);
}
This works fine when stdin
is empty, but when piping anything into the command it will crash:
thread 'main' panicked at src\main.rs:8:21:
called `Result::unwrap()` on an `Err` value: IO(Os { code: 1, kind: Uncategorized, message: "Incorrect function." })
I am on windows, msvc toolchain, rust 1.75.0.
I'm having the same issue running on Linux. Piping from another process raises an error IO error: Bad file descriptor (os error 9)
.
Anyone figured out a workaround?
The following code reads bytes from stdin and then enters the password:
This works well when the user enters bytes directly. However, when inputting bytes via redirect or pipe (e.g.
echo "foo" | cmd
orcmd < infile
), this returnsBad file descriptor
when entering the password.