From bbf79e6d71182879c3d93373d9cbd5cb606c8864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elmir=20Be=C5=A1irovi=C4=87?= Date: Mon, 9 Nov 2026 18:04:05 +0100 Subject: [PATCH] fix: resume stdin when setting up dev server interactions Fixes #1515 --- .../common/__tests__/setupInteractions.test.ts | 14 ++++++++++++++ .../src/commands/common/setupInteractions.ts | 2 ++ 2 files changed, 16 insertions(+) diff --git a/packages/repack/src/commands/common/__tests__/setupInteractions.test.ts b/packages/repack/src/commands/common/__tests__/setupInteractions.test.ts index 70287e994..3fb87abb8 100644 --- a/packages/repack/src/commands/common/__tests__/setupInteractions.test.ts +++ b/packages/repack/src/commands/common/__tests__/setupInteractions.test.ts @@ -30,6 +30,7 @@ describe('setupInteractions', () => { }, stdin: { setRawMode: jest.fn(), + resume: jest.fn(), on: jest.fn(), }, stdout: { @@ -85,6 +86,19 @@ describe('setupInteractions', () => { ); }); + it('should resume stdin so keypresses are delivered after it was paused', () => { + setupInteractions( + {}, + { + logger: mockLogger, + process: mockProcess, + readline: mockReadline, + } + ); + + expect(mockProcess.stdin.resume).toHaveBeenCalledTimes(1); + }); + it('should handle ctrl+c and ctrl+z keypresses', () => { setupInteractions( {}, diff --git a/packages/repack/src/commands/common/setupInteractions.ts b/packages/repack/src/commands/common/setupInteractions.ts index 3d5f1136f..935187da8 100644 --- a/packages/repack/src/commands/common/setupInteractions.ts +++ b/packages/repack/src/commands/common/setupInteractions.ts @@ -40,6 +40,8 @@ export function setupInteractions( readline.emitKeypressEvents(process.stdin); process.stdin.setRawMode(true); + // Raw mode makes Ctrl+C arrive only as stream data, so a paused stream would swallow it. + process.stdin.resume(); // graceful shutdown process.on('SIGINT', () => {