dodoshell opened a new pull request, #1944:
URL: https://github.com/apache/maven-mvnd/pull/1944

   On master, Ctrl+C pressed before the client is connected to a daemon only 
takes effect once the build has been sent. With JLine 4, raw mode clears ISIG, 
so Ctrl+C arrives as byte 3 and is turned into INT only by JLine's software 
signals, which need a thread reading the terminal. 
`TerminalInputHandler.handleControlKeys` did not read anything until 
`daemonReceive` was set, i.e. after `DaemonConnector.connect` returned.
   
   `TerminalInputHandler` now reads the terminal before the connection too and 
handles Ctrl+C itself: it sends `CANCEL_BUILD` to `daemonDispatch`, which 
interrupts the main thread before the connection (`DaemonConnector` honours the 
interrupt while waiting for a new daemon) and cancels the build after it. 
Ctrl+C is also handled in prompts and while reading project input. JLine's 
software signals are turned off in `TerminalOutput`, so Ctrl+C is not handled 
twice and keeps working if JLine 5 changes their default (jline/jline3#1960). 
`TerminalBuilder` has no option for this, so it is set through the 
`org.jline.terminal.softwareSignals` system property. Other keys typed before 
the connection are dropped instead of being forwarded to the build. The `INT` 
handler is kept for real SIGINTs, e.g. on dumb terminals.
   
   Added `TerminalInputHandlerTest`, which drives the handler with a non-system 
JLine terminal in raw mode fed from a pipe; the four tests fail on master and 
pass with this change.
   
   Fixes #1943
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to