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

Macchina does not work without /dev/stdin on macOS #328

Open
pallxk opened this issue Sep 14, 2024 · 3 comments
Open

Macchina does not work without /dev/stdin on macOS #328

pallxk opened this issue Sep 14, 2024 · 3 comments
Labels
type/bug Something isn't working.

Comments

@pallxk
Copy link
Contributor

pallxk commented Sep 14, 2024

Describe the bug
Macchina does not work without /dev/stdin on macOS.
I've also tested on Arch Linux x86_64 and Arch Linux aarch64, they both work without /dev/stdin.

To Reproduce
Steps to reproduce the behavior:

  1. macchina < /dev/null

Expected behavior
Macchina runs correctly.

Actual behavior
It hangs and cannot exit with CTRL-C.

Usage Scenario
I put macchina into my .bashrc script, and would like it to not consume /dev/stdin, so that

  • I can type ahead when .bashrc script (macchina and others) runs;
  • and shell can accept external input on startup.
    • e.g. VSCode can spawn an integrated terminal, feed command into it, and then run it. (e.g. VSCode Python virtualenv integration)
    • currently the above does not work as the initial command fed into the terminal will be consumed by macchina.

Screenshots
image

macchina --doctor output

We've collected a total of 20 readouts including 2 failed read(s) and 1 read(s) resulting in a warning.

Readout "LocalIP" failed with message: Unable to get local IPv4 address.
Readout "GPU" failed with message: This metric is not available on this platform or is not yet implemented by libmacchina.

1 of the 3 unsuccessful read(s) resulted in a warning:
 Readout "Distribution" threw a warning with message: Since you're on macOS, there is no distribution to be read from the system.

System Information

  • Operating System: macOS 15.1 Beta
  • Terminal: iTerm2
  • Macchina's version: macchina 6.2.1; libmacchina 7.3.1

I've also tested with macchina 6.1.8, it's the same issue for me.

@pallxk
Copy link
Contributor Author

pallxk commented Sep 14, 2024

Some more findings on this:

  • macchina < /dev/null hangs with 100% CPU usage;
  • macchina < /dev/null > file works;
  • some debugging shows it hangs at backend.get_cursor_position(), which calls crossterm::cursor::position().

Now it seems like a crossterm bug...

@pallxk
Copy link
Contributor Author

pallxk commented Sep 14, 2024

Related crossterm bug at crossterm-rs/crossterm#828

Workaround for macchina users on macOS:

macchina < /dev/null > >(cat)

@grtcdr
Copy link
Member

grtcdr commented Sep 14, 2024

Thanks for sharing that workaround, we'll upgrade to a non-affected version of crossterm when that issue is eventually addressed.

@grtcdr grtcdr added the type/bug Something isn't working. label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working.
Development

No branches or pull requests

2 participants