Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-windows-update-console-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Keep automatic background updates from flashing a console window on Windows.
4 changes: 4 additions & 0 deletions apps/kimi-code/src/cli/update/preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ async function startBackgroundInstall(
detached: true,
stdio: 'ignore',
shell: platform === 'win32' ? true : undefined,
// On Windows a detached child gets its own console window; with shell:true
// that window would flash during a passive background update. Hide it so
// the silent updater stays silent.
windowsHide: platform === 'win32' ? true : undefined,
});
child.once('error', () => { finish(false); });
child.once('exit', (code) => { finish(code === 0); });
Expand Down
21 changes: 21 additions & 0 deletions apps/kimi-code/test/cli/update/preflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,27 @@ describe('runUpdatePreflight', () => {
}));
});

it('win32 background auto-update hides the console window', async () => {
mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0'));
mocks.readUpdateInstallState.mockResolvedValue(installState());
mocks.refreshUpdateCache.mockResolvedValue(cacheWith('0.5.0'));
mocks.detectInstallSource.mockResolvedValue('npm-global');
mockSpawnExit(0);
const originalPlatform = process.platform;
Object.defineProperty(process, 'platform', { value: 'win32' });
try {
const { options } = captureOutput();
await expect(runUpdatePreflight('0.4.0', options)).resolves.toBe('continue');
expect(mocks.spawn).toHaveBeenCalledWith(
'npm.cmd',
['install', '-g', '@moonshot-ai/kimi-code@0.5.0'],
{ detached: true, stdio: 'ignore', shell: true, windowsHide: true },
);
} finally {
Object.defineProperty(process, 'platform', { value: originalPlatform });
}
});

it('tracks and logs successful background update installs', async () => {
mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0'));
mocks.readUpdateInstallState.mockResolvedValue(installState());
Expand Down
Loading