ruby / yamatanooroti

MIT License
0 stars 6 forks source link

PTY.swawn without using bash and stty #11

Closed tompng closed 1 month ago

tompng commented 1 month ago

Unnecessarily using bash to run command seems to make a zombie process sometimes. Process.kill can't stop that process and Process.waitpid(pid) waits forever. I don't know why. PTY.spawn(command); pty_output.winsize = [h, w] is enough.

It is better to set winsize BEFORE process spawns (this pull request sets winsize AFTER spawn) but it looks working, it's simple, and it solves a problem.

How to reproduce

  1. Use #10 in IRB and Reline's rendering test
  2. Modify the test code to make it pass with start_terminal(*args, wait: 0.001)
  3. Run rendering test again with wait: 0.0001

I have no idea why it is reproducible only with very short wait time.