Skip to content

fix(hooks): replace DETACHED_PROCESS with CREATE_NO_WINDOW on Windows - #2254

Closed
hopstreax wants to merge 2 commits into
Graphify-Labs:v8from
hopstreax:fix/2253-windows-hook-console-window
Closed

fix(hooks): replace DETACHED_PROCESS with CREATE_NO_WINDOW on Windows#2254
hopstreax wants to merge 2 commits into
Graphify-Labs:v8from
hopstreax:fix/2253-windows-hook-console-window

Conversation

@hopstreax

Copy link
Copy Markdown
Contributor

Summary

Fixes #2253.

On Windows, Graphify's Git hook launcher started the background rebuild using DETACHED_PROCESS together with python.exe. Since python.exe is a console-subsystem executable, this caused Windows to open a new console window during every background rebuild triggered by post-commit and post-checkout hooks.

This change replaces DETACHED_PROCESS with CREATE_NO_WINDOW while preserving the existing detached background execution behavior by keeping:

  • CREATE_NEW_PROCESS_GROUP
  • CREATE_BREAKAWAY_FROM_JOB (best-effort)

The POSIX launch path (start_new_session=True) is unchanged.

Changes

  • Replace the Windows DETACHED_PROCESS creation flag with CREATE_NO_WINDOW in the hook launcher.
  • Update the launcher comment to reflect the new Windows creation flag.
  • Update the corresponding regression test to verify the generated launcher contains CREATE_NO_WINDOW.

Why this approach?

The hook launcher introduced in #1161 was designed to replace the previous nohup-based implementation with a cross-platform Python launcher. This change preserves those original design goals:

  • Git commits return immediately.
  • Background rebuilds continue independently.
  • Cross-platform behavior remains unchanged.
  • No dependency on shell-specific utilities.

CREATE_NO_WINDOW suppresses the unwanted console window while retaining the existing process-group behavior through CREATE_NEW_PROCESS_GROUP and the existing best-effort CREATE_BREAKAWAY_FROM_JOB.

Validation

Tested on Windows by:

  • Installing Git hooks with graphify hook install
  • Performing Git commits
  • Verifying no console window appears
  • Verifying commits complete immediately
  • Verifying the background rebuild still executes
  • Verifying rebuild logs are still written
  • Verifying graph.json, graph.html, and GRAPH_REPORT.md are regenerated

Also updated and ran the relevant hook regression test to validate the generated launcher uses the expected Windows creation flags.

@safishamsi

Copy link
Copy Markdown
Collaborator

Thanks @hopstreax. Shipped in v0.9.29 (cherry-picked to v8 to preserve authorship). Closed-unmerged here, but it's in the release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.29

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.

post-commit hook launcher pops a focus-stealing console window on every Windows commit — DETACHED_PROCESS on a console-subsystem sys.executable

2 participants