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

terminal: notify when terminal has quit #189

Open
marceline-cramer opened this issue Oct 31, 2023 · 2 comments
Open

terminal: notify when terminal has quit #189

marceline-cramer opened this issue Oct 31, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers host Deals with host side code moderate Moderate difficulty to accomplish

Comments

@marceline-cramer
Copy link
Collaborator

marceline-cramer commented Oct 31, 2023

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 marceline-cramer added bug Something isn't working good first issue Good for newcomers labels Oct 31, 2023
@airidaceae
Copy link
Collaborator

If I understand this correctly the TerminalInstance is a guest-side process that wraps around the actual terminal which must run on the host-side to access system resources.

Would there be a way to send a message to the owning process informing it of its death similar to a Monitor system?
Or require a layer of abstraction where there is another process acting as the middle man to the host-side. This process could either be killed directly or poll and then kill itself which would send a message to anything monitoring it making it much easier to handle.

@marceline-cramer marceline-cramer added guest Deals with guest side code host Deals with host side code and removed guest Deals with guest side code labels Nov 15, 2023
@marceline-cramer
Copy link
Collaborator Author

TerminalRoutine may honestly be the best place to poll terminal death. Each TerminalWrapper could contain an OwnedCapability to its instance that TerminalRoutine may import into a table and kill in order to kill the terminal instance and inform any monitors that the terminal has closed.

@marceline-cramer marceline-cramer added the moderate Moderate difficulty to accomplish label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers host Deals with host side code moderate Moderate difficulty to accomplish
Projects
None yet
Development

No branches or pull requests

2 participants