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
26 changes: 26 additions & 0 deletions packages/core/src/services/shellExecutionService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,32 @@ describe('ShellExecutionService', () => {
);
});

it('suppresses parser diagnostics for malformed PTY output', async () => {
const consoleErrorSpy = vi
.spyOn(console, 'error')
.mockImplementation(() => {});

try {
const { result } = await simulateExecution(
'malformed-output',
(pty) => {
pty.onData.mock.calls[0][0]('\u001b\xb0');
pty.onData.mock.calls[0][0]('recovered');
pty.onExit.mock.calls[0][0]({ exitCode: 0, signal: null });
},
);

expect(
consoleErrorSpy.mock.calls.some((args) =>
args.some((arg) => String(arg).includes('Parsing error')),
),
).toBe(false);
expect(result.output).toContain('recovered');
} finally {
consoleErrorSpy.mockRestore();
}
});

it('should correctly decode multi-byte characters split across chunks', async () => {
const { result } = await simulateExecution('echo "你好"', (pty) => {
const multiByteChar = '你好';
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/services/shellExecutionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ const replayTerminalOutput = async (
rows,
scrollback: 10000,
convertEol: true,
// This headless terminal only captures output, so suppress parser diagnostics.
logLevel: 'off',
});

try {
Expand Down Expand Up @@ -1486,6 +1488,8 @@ export class ShellExecutionService {
cols,
rows,
scrollback: MAX_LIVE_TERMINAL_SCROLLBACK_LINES,
// This headless terminal only captures output, so suppress parser diagnostics.
logLevel: 'off',
});
headlessTerminal.scrollToTop();

Expand Down
Loading