y-yagi / minitest-sound

MIT License
6 stars 0 forks source link

Terminal doesn't echo anymore after running test suite on macOS #20

Open svoop opened 7 years ago

svoop commented 7 years ago

Using minitest/sound/reporter on macOS 10.12 (can't test on other OSes), the terminal sometimes does not echo anymore after running the test suite. This happens:

With "does not echo" I mean that the terminal still fully works, but keystrokes are not echoed (displayed) anymore. The only fix is blindly executing reset.

svoop commented 7 years ago

The problem appears to be mpg123 (version 1.23.8 from Homebrew). It somehow manages to disable terminal echo sometimes, but not always.

Forcing stty echo is a quick fix:

pid = spawn("mpg123 #{file}; stty echo", err: '/dev/null')

I guess it's safe to assume the echo should be set since you're usually running the tests in either a work or a fully hidden terminal.

The proper solution involves asking upstream why mpg123 fiddles with echo. Unfortunately, I don't have the time to dig deeper.