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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('setupInteractions', () => {
},
stdin: {
setRawMode: jest.fn(),
resume: jest.fn(),
on: jest.fn(),
},
stdout: {
Expand Down Expand Up @@ -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(
{},
Expand Down
2 changes: 2 additions & 0 deletions packages/repack/src/commands/common/setupInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading