mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
parent
ab1c483cab
commit
1a2906a8ad
16 changed files with 412 additions and 442 deletions
|
|
@ -104,6 +104,7 @@ export const useShellCommandProcessor = (
|
|||
const execPromise = new Promise<void>((resolve) => {
|
||||
let lastUpdateTime = Date.now();
|
||||
let cumulativeStdout = '';
|
||||
let cumulativeStderr = '';
|
||||
let isBinaryStream = false;
|
||||
let binaryBytesReceived = 0;
|
||||
|
||||
|
|
@ -141,7 +142,11 @@ export const useShellCommandProcessor = (
|
|||
case 'data':
|
||||
// Do not process text data if we've already switched to binary mode.
|
||||
if (isBinaryStream) break;
|
||||
cumulativeStdout = event.chunk;
|
||||
if (event.stream === 'stdout') {
|
||||
cumulativeStdout += event.chunk;
|
||||
} else {
|
||||
cumulativeStderr += event.chunk;
|
||||
}
|
||||
break;
|
||||
case 'binary_detected':
|
||||
isBinaryStream = true;
|
||||
|
|
@ -167,7 +172,9 @@ export const useShellCommandProcessor = (
|
|||
'[Binary output detected. Halting stream...]';
|
||||
}
|
||||
} else {
|
||||
currentDisplayOutput = cumulativeStdout;
|
||||
currentDisplayOutput =
|
||||
cumulativeStdout +
|
||||
(cumulativeStderr ? `\n${cumulativeStderr}` : '');
|
||||
}
|
||||
|
||||
// Throttle pending UI updates to avoid excessive re-renders.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue