Skip to content

fix: hide console window when running 'git rev-parse HEAD' on Windows#941

Merged
andreiborza merged 1 commit into
getsentry:mainfrom
jwwisgerhof:fix/git-rev-parse-windows-hide
Jun 17, 2026
Merged

fix: hide console window when running 'git rev-parse HEAD' on Windows#941
andreiborza merged 1 commit into
getsentry:mainfrom
jwwisgerhof:fix/git-rev-parse-windows-hide

Conversation

@jwwisgerhof

Copy link
Copy Markdown
Contributor

gitRevision() in packages/bundler-plugins/src/core/utils.ts runs execSync("git rev-parse HEAD", { stdio: [...] }) to auto-detect the release name. It passes no windowsHide, and Node's child_process defaults it to false. This is the fallback determineReleaseName() uses in local dev (when no CI/SENTRY_RELEASE env var is set).

When the bundler config is loaded by a console-less parent process, Windows allocates a new console for the git child and the default-terminal handoff renders it as a visible terminal window that flashes up and steals focus.

Real-world impact

This is probably quite limited in real world impact as this command should not be run on local dev machines. However, where it does, it fires constantly when running a Vite project inside (for example) an Nx workspace (nx serve): Nx's project-graph daemon reloads the Vite config — and thus the Sentry plugin's release detection — in a console-less plugin worker on every file save, so a terminal window flashes every single time you save a file. Surfaced via nrwl/nx-console#2906 (comment) (there's a companion fix in Vite for its own net use call).

Fix

Add windowsHide: true to the execSync options. No behavioural change to release detection; windowsHide does nothing on macOS/Linux.

Tests

Added a unit test asserting execSync is invoked with windowsHide: true.

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jwwisgerhof, thanks for contributing this, sounds like a good improvement to me!

@andreiborza andreiborza merged commit 988efd3 into getsentry:main Jun 17, 2026
24 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