Hi Norman,
On 12/6/19 11:02 AM, Norman Feske wrote:
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)?
Thank you for your suggestion. While I like the idea of using the terminal size {0,0} as a way to communicate end of data, I'm not sure if it's applicable in my case. Let me draw up my scenario in init config snippets:
``` <start name="java" caps="300"> <resource name="RAM" quantum="96M"/> <config> <libc stdin="/dev/terminal" stdout="/dev/terminal" stderr="/dev/log"/> <arg value="/bin/java" /> ... </config> <route> <any-service> <any-child/> <parent/> </any-service> </route> </start>
<start name="my-terminal-server" caps="300"> <resource name="RAM" quantum="8M"/> <provides> <service name="Terminal"/> <service name="LOG"/> </provides> <config> <libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/> <policy label="java -> terminal"/> <policy label="java -> stderr"/> </config> </start> ```
So, the way I see it in this case, I'm not really in control of the Terminal client. Or, if I understand you correctly, I would have to change the libc implementation by handling the `size_changed_sigh` and if the new size is {0,0} I would emulate a EOF signal to the jvm. While I'm hesitant changing the Terminal session, I'm even more hesitant to extend libc with this workaround. Just to emphasize my case a bit more. I'm not in control of the Java application. The Java application is expected to handle stdin and stdout in a request/respond kind of way. So the EOF signal from the Java applications perspective is not used to gracefully shutdown itself, but to know when no more data is transferred. Does the combination of the posix runtime and a terminal or pipe connection to it not call for a EOF signal?
Best, Sid