Skip to content

Confirm before closing a window with a run in progress (#332) - #529

Merged
jtklein merged 1 commit into
AntonelliLab:masterfrom
jtklein-agents:332-raxml-keeps-running-after-close
Nov 27, 2026
Merged

jtklein merged 1 commit into
AntonelliLab:masterfrom
jtklein-agents:332-raxml-keeps-running-after-close

Conversation

@jtklein-agents

Copy link
Copy Markdown
Contributor

Closing the window or quitting while a run is in progress now asks first. Before this, on macOS a closed window left its run going with no window. After quit, a binary stayed alive (reparented to launchd) until its next stdout write killed it; a binary that wrote nothing outlived the app. Findings: jtklein-agents#332.

Summary

 createMainWindow
   new BrowserWindow
+  confirmCloseWithRuns( win, dialog, app )
on(window close)                       # Cmd+Q / menu Quit also close the window
  if no run is tracked
    close
  prevent close (this also cancels a quit)
  if the dialog is already open
    return
  ask "Do you really want to stop the run by closing the window?"
    Cancel                → nothing changes
    Stop run and close    → stopAllRuns()      # cancelRun for each tracked run
                            quit again if a quit started this, else close

src/main/cancelRun.ts gains hasRuns() and stopAllRuns(). The app has a single window, so every tracked run belongs to it.

Evidence

  • Before: an Electron main spawned raxmlHPC, raxml-ng and modeltest-ng the way spawnProcess does, then called app.quit(). A silent child (/bin/sleep) survived with PPID 1. The binaries died only at their next write.
    After: the built app was driven with Playwright and the dialog stubbed in main, during a ModelTest-NG run:

    run started, modeltest pids: 95271
    after close + Cancel: { windows: 1, asked: 1 } modeltest: 95271
    after quit + Stop: app exited: true modeltest: none
    no run, close: { windows: 0, asked: 0 }
    
  • src/main/confirmClose.test.ts covers five cases:

    • no run: no dialog
    • Cancel: the run and the window are kept
    • Stop: the run is killed and the window closes
    • Stop during a quit: the app quits again
    • a quit while the dialog is open: one dialog, then the app quits

    Full suite: 502 tests pass.

Merge Danger

Door: two-way

Revert the commit to restore the old close behaviour. No data or files are touched.

Blast Radius: window-close

Every window close and every quit now goes through this guard. It is only checked on macOS.

  • Windows (unchecked): spawnProcess runs the binary through cmd.exe (shell: true). proc.kill() may stop only cmd.exe and leave the binary running, after Stop and after the existing Cancel button alike.
  • ASTRAL: not exercised (no jar or JRE locally).
  • Updates: autoUpdater.quitAndInstall() during a run now shows the dialog too.

🤖 Generated with Claude Code

On macOS a closed window left its run going, and on quit a spawned binary
outlived the app until its next stdout write. Closing or quitting with a
tracked run now asks first; Stop kills every tracked run, then closes or
quits. Cancel leaves the window and run as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein
jtklein merged commit d740620 into AntonelliLab:master Nov 27, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants