crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Terminal unresponsive when using Cursive crossterm-backend and echo

Open joelparkerhenderson opened this issue 2 years ago • 4 comments

The bug happens when I use Cursive with crossterm-backend, and does not happen when I use Cursive with termion-backend, or ncurses backend.

Describe the bug

Terminal is unresponsive when using Crossterm and Cursive, when enabling Cursive feature crossterm-backend.

Specifically, Cursive launches the TUI, but it doesn't respond to key presses.

To Reproduce

Minimal reproduction code.

File Cargo.toml includes:

[dependencies]
cursive = { version = "*", features = ["crossterm-backend"] }

File main.rs:

fn main() {
    let mut c = cursive::crossterm();
    c.run();
}

Run:

./target/debug/demo

Cursive shows a blank screen, as expected.

Press ctrl-c to exit, as expected.

Run:

echo "" | ./target/debug/demo

Cursive shows a blank screen, as expected.

Press ctrl-c to exit-- but it doesn't work. This is the bug. A real-world app with more kinds of inputs has all of the fail, such as for Checkbox, EditView, tec.

Expected behavior

Expected: Cursive responds to keys.

Actual: Cursive does not responds to keys.

I've confirmed this problem happens with other kinds of UI/UX, such as other keypresses, and also by using other Cursive functionality, such as a TextView, or EditView, or Button, etc.

OS

macOS Ventura 13.0 on a MacBook Pro with Apple M1 Max chip

Terminal/Console

macOS Terminal app i.e. the default macOS terminal application

Question

When the Crossterm documentation states "It supports all UNIX and Windows terminals down to Windows 7", does Crossterm currently support UNIX on macOS with Apple M1? I ask because I see some past posts that discuss Crossterm macOS M1 issues/incompatibilities/roadmaps.

If yes, then what's the next step please, to troubleshoot this bug?

If no, then could a maintainer edit to the README and documentation to note that Crossterm is currently not intending to be run on macOS with Apple M1?

Thank you for your consideration.

joelparkerhenderson avatar Oct 30 '22 19:10 joelparkerhenderson

I doubt that the issue lies in crossterm, you can make sure by testing the examples provided in this repo.

sigmaSd avatar Oct 30 '22 19:10 sigmaSd

Thank you. Same symptom happens in the Crossterm examples.

I've edited the top post to emphasize that the symptom involves "echo".

Reproduce:

git clone [email protected]:crossterm-rs/crossterm.git
cd crossterm/examples/interactive-demo
cargo build

This succeeds:

./target/debug/interactive-demo

This hangs:

echo "" | ./target/debug/interactive-demo

joelparkerhenderson avatar Oct 31 '22 05:10 joelparkerhenderson

Yeah that's a known issue on Mac os, there is a PR that should improve things https://github.com/crossterm-rs/crossterm/pull/711

sigmaSd avatar Oct 31 '22 05:10 sigmaSd

Thank you for the fast info-- that is very helpful to know. Feel free to close this issue because it's already a known issue.

joelparkerhenderson avatar Oct 31 '22 06:10 joelparkerhenderson