fix: hide Windows update check consoles (#2231)

## Summary

Fixes #2230.

- Sets `windowsHide: true` on the detached update-check process so
Windows does not flash a console window.
- Also hides the `npm config get registry` subprocess used by the
updater helper.
- Covers the update-check spawn options in the existing tests.

## Verification

- `NODE_OPTIONS=--max-old-space-size=4096 npm run build`
- `npm run test:no-build -- tests/check-for-updates.test.ts`
- `NODE_OPTIONS=--max-old-space-size=4096 npx eslint
src/utils/check-for-updates.ts src/bin/check-latest-version.ts
tests/check-for-updates.test.ts`
- `npx prettier --check src/utils/check-for-updates.ts
src/bin/check-latest-version.ts tests/check-for-updates.test.ts`
- `git diff --check`

Note: plain `npm run build` and full-repo `npm run check-format` hit the
local Node heap limit in this runner; the same build passed with the
heap limit raised, and touched-file lint/format checks passed.

Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
This commit is contained in:
Rayan Salhab
2026-06-19 08:31:01 +03:00
committed by GitHub
parent 5a9d6af743
commit 6225ffbaf1
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ function getRegistry(): string {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
timeout: 5000,
windowsHide: true,
})
.trim()
.replace(/\/$/, '');
+1
View File
@@ -88,6 +88,7 @@ export async function checkForUpdates(message: string) {
{
detached: true,
stdio: 'ignore',
windowsHide: true,
},
);
child.unref();
+2
View File
@@ -139,6 +139,7 @@ describe('checkForUpdates', () => {
);
assert.ok(spawnStub.firstCall.args[1][1]?.includes('latest.json'));
assert.strictEqual(spawnStub.firstCall.args[2]?.detached, true);
assert.strictEqual(spawnStub.firstCall.args[2]?.windowsHide, true);
assert.ok(unrefSpy.calledOnce);
});
@@ -163,6 +164,7 @@ describe('checkForUpdates', () => {
);
assert.ok(spawnStub.firstCall.args[1][1]?.includes('latest.json'));
assert.strictEqual(spawnStub.firstCall.args[2]?.detached, true);
assert.strictEqual(spawnStub.firstCall.args[2]?.windowsHide, true);
assert.ok(unrefSpy.calledOnce);
});
});