Hi Sid,
On 04.12.19 15:29, Sid Hussmann wrote:
So a first tempting approach to this problem would be to extend the Terminal session interface with a signal handler for EOF. However... I'm hesitant to touch such a prominent session.
Is there an other approach to this? Maybe using the newly released vfs pipe plugin? Or via emulation of POSIX signals?
this question reminds me to a very similar problem I had to solve for the graphical terminal in Sculpt. When clicking on the close button of a terminal window, I wanted to gracefully exit the Noux runtime that is connected to the terminal by reflecting the condition as EOF to the Noux application.
I solved it by using the existing 'size_changed_sigh' mechanism, which allows a terminal client to install a signal handler that is invoked each time the terminal size changes. Once the client receives the signal, it can request the new dimensions via the 'size' RPC function. The returned size is a tuple of (columns,rows) e.g., (80x25). A size of (0,0) implies that the terminal window got closed. This condition is used by Noux to feed the EOF to the Noux application. You can find the corresponding code at [1].
[1] https://github.com/genodelabs/genode/blob/master/repos/ports/src/noux/termin...
By the way, the same pattern is used by the framebuffer-session interface to gracefully wind down a framebuffer client when displayed in a window.
Would you be fine with following this path in your terminal server, sending the EOF as a terminal-size change to (0,0)?
Cheers Norman