[NPMCLI-102] Improve stopping Tomcat on Windows Created: 10/Feb/17  Updated: 16/Feb/17  Resolved: 15/Feb/17

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0

Type: Improvement Priority: Neutral
Reporter: Federico Grilli Assignee: Cedric Reichenbach
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Basel 83
Story Points: 3

 Description   

While documenting the new CLI 2.0 ruths reported an issue with Windows10 and the new mgnl start command. Trying to stop the server with Ctrl+C works only from the tomcat process terminal spawned automatically when launching the start command.
Need to investigate whether the same happens on Windows7 or if there one can stop the server directly from the terminal where the mgnl start command was launched. In case of a different behavior, ideally this should be documented inline by the CLI itself.



 Comments   
Comment by Cedric Reichenbach [ 15/Feb/17 ]

Played around with it on Windows 10 (and PowerShell):

  1. After mgnl start, an error message is printed if the module dir path contains a space (hard to tell from where it comes, as it was localized), e.g. if the path is C:\Users\Cedric Reichenbach\dev\foobar , the message was something along the lines of Could not find path C:\Users\Cedric. However, Magnolia still starts up.
  2. Ctrl+C (SIGINT) is actually detected by the node script, but spawn}}ing child processes (for {{magnolia_control.bat stop) doesn't work at this point. As a workaround, we could use execFile, which works on Windows and seems semantically more appropriate anyway. The only grain of salt is that magnolia_control.bat doesn't terminate automatically ("press any key to continue"), but we should be fine with just exiting after a few seconds.

I pushed a POC for 2. in the branch windows-ctrl-c. For what it's worth, this also fixes 1. for some reason.

The diff

Generated at Mon Feb 12 04:46:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.