slachiewicz opened a new issue, #1943:
URL: https://github.com/apache/maven-mvnd/issues/1943

   On master, the client cannot be interrupted until it is connected to a 
daemon. A Ctrl-C pressed earlier is held back, and once the client connects it 
cancels the build that was just sent. The new daemon is then left in the 
Canceled state.
   
   To reproduce with the JVM client (`mvnd.sh`), a one-module project and no 
running daemon, press Ctrl-C about half a second after starting `mvnd 
validate`. The client exits with 130 after about 1.4 s, and the daemon log 
shows:
   
   ```
   I Request received: BuildRequest{...}
   I Received message: BuildCanceled
   I Updating state to: Canceled
   ```
   
   Today the gap is the daemon start-up, under a second. Anything that makes 
the client wait before it connects (for example a daemon limit, as in #1927) 
turns it into a wait the user cannot leave.
   
   Cause: JLine 4 clears `ISIG` in `Terminal.enterRawMode()` 
(jline/jline3#1900, jline/jline3#1912), so Ctrl-C no longer sends SIGINT. 
`Terminal.handle(Signal.INT, …)` still works through JLine's `softwareSignals` 
(jline/jline3#1959), but only while some thread reads the terminal. 
`TerminalOutput` enters raw mode and registers the `INT` handler at 
construction, but `TerminalInputHandler.handleControlKeys` reads nothing until 
`daemonReceive` is set, which happens after `DaemonConnector.connect` returns.
   
   - Affects master only. `mvnd-1.x` and 2.0.0-rc-3 use JLine 3, where raw mode 
keeps `ISIG`.
   - jline/jline3#1960 proposes defaulting `softwareSignals` to false in JLine 
5. mvnd would then lose Ctrl-C during builds as well, since cancel goes through 
the same handler.
   - The JLine that matters is the one in Maven's `lib/`. The master 
distribution ships `jline-*-4.4.5.jar` from Maven 4.0.0-rc-7, although 
`pom.xml` declares 4.5.0.
   
   Proposed fix: let `handleControlKeys` read while `daemonReceive` is null, 
and treat byte 3 as cancel in mvnd's own input handling instead of relying on 
JLine's signal emulation. Keys typed before the connection would then be 
dropped, not forwarded to the build.
   
   


-- 
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