JLine3 Signal Handling
amarktl opened this issue · comments
I am working on a CLI Application based on Quarkus and Picocli using JLINE3.
One command forks another application / shell script which uses "trap" to react on system signals.
Once the application is forked i can use my CLI Application normally and everything works as expected, but when i use 'ctrl-c' to e.g. abort the current line the signal is "trapped" by my forked application and it terminates.
I tried implementing signal handling for the terminal as documented here https://github.com/jline/jline3/wiki/Terminals#signal-support or even directly implementing sun.misc.SignalHandler. But none of my ideas worked - nothing ever hit my signal handler.
I also tried to override the keybinding ctrl-c to a custom widget - but that also failed to give the result i want.
The forked script terminates and i get a UserInterruptException from the LineReader - afterwards.
I started of with this demo https://github.com/remkop/picocli/tree/main/picocli-shell-jline3
Sorry, this is outside of my area of expertise.
This sounds like the JLine maintainers may be better positioned to help. Can you raise this in the JLine project?