hearth icon indicating copy to clipboard operation
hearth copied to clipboard

terminal: notify when terminal has quit

Open marceline-cramer opened this issue 1 year ago • 2 comments

Right now, if a process running in a terminal quits, the guest has no way of knowing about it. We have a few ways of fixing this:

  • Polling: add a TerminalUpdate variant that polls the terminal for whether it's quit or not. Downside is that we have to continuously poll from whatever owns the terminal, which is ugly and inefficient.
  • Subscription: add a TerminalUpdate that subscribes a capability to a message that lets it know when that terminal has quit. Downsides are that it's clunky to implement in the API. We also need to find a way to use the state of a TerminalInstance even though it's being ran as a SinkProcess.
  • Killing: somehow wait for the terminal to quit in a separate Tokio thread, then kill the TerminalInstance. We can use down signals to notify processes when the terminal has exited. Downside is that the terminal immediately disappears once it's been killed.

marceline-cramer avatar Oct 31 '23 00:10 marceline-cramer