Skip to content

Commit 6225ffb

Browse files
authored
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>
1 parent 5a9d6af commit 6225ffb

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/bin/check-latest-version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function getRegistry(): string {
2121
encoding: 'utf8',
2222
stdio: ['ignore', 'pipe', 'ignore'],
2323
timeout: 5000,
24+
windowsHide: true,
2425
})
2526
.trim()
2627
.replace(/\/$/, '');

src/utils/check-for-updates.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export async function checkForUpdates(message: string) {
8888
{
8989
detached: true,
9090
stdio: 'ignore',
91+
windowsHide: true,
9192
},
9293
);
9394
child.unref();

tests/check-for-updates.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ describe('checkForUpdates', () => {
139139
);
140140
assert.ok(spawnStub.firstCall.args[1][1]?.includes('latest.json'));
141141
assert.strictEqual(spawnStub.firstCall.args[2]?.detached, true);
142+
assert.strictEqual(spawnStub.firstCall.args[2]?.windowsHide, true);
142143
assert.ok(unrefSpy.calledOnce);
143144
});
144145

@@ -163,6 +164,7 @@ describe('checkForUpdates', () => {
163164
);
164165
assert.ok(spawnStub.firstCall.args[1][1]?.includes('latest.json'));
165166
assert.strictEqual(spawnStub.firstCall.args[2]?.detached, true);
167+
assert.strictEqual(spawnStub.firstCall.args[2]?.windowsHide, true);
166168
assert.ok(unrefSpy.calledOnce);
167169
});
168170
});

0 commit comments

Comments
 (0)