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

JLine3 Signal Handling #940

Open
amarktl opened this issue Feb 21, 2024 · 2 comments
Open

JLine3 Signal Handling #940

amarktl opened this issue Feb 21, 2024 · 2 comments

Comments

@amarktl
Copy link

amarktl commented Feb 21, 2024

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

I was pointed in the direction of jline3 by @remkop to seek for help here. :)

I raised the issue here remkop/picocli#2213 in the first place.

@gnodet
Copy link
Member

gnodet commented Feb 27, 2024

Could you attach your full application and describe your environment ? OS + JDK. Make sure you use JLine 3.25.1 ...

@amarktl
Copy link
Author

amarktl commented Mar 11, 2024

I cannot post my full application here, but i will try to create a reproducer.

My system is as follows: FEDORA 39 (6.7.7-200.fc39.x86_64)

openjdk 21.0.1 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)

We are using the PICOCLI JLine3 integration and this one pulls:

+--- info.picocli:picocli-shell-jline3:4.7.5
| +--- info.picocli:picocli:4.7.5
| --- org.jline:jline:3.23.0
+--- org.fusesource.jansi:jansi:$jansi -> 2.4.0

My colleagues are using windows and also reported the same issue.

I can try to force an update of jline to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants