From 30b4dcecbc40598be121a26197ccbbe004bdcfff Mon Sep 17 00:00:00 2001 From: jacob314 Date: Thu, 26 Feb 2026 14:54:29 -0800 Subject: [PATCH] Code review fix. --- .../cli/src/ui/hooks/useExecutionLifecycle.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/ui/hooks/useExecutionLifecycle.ts b/packages/cli/src/ui/hooks/useExecutionLifecycle.ts index 95cfac041b..68166c84dd 100644 --- a/packages/cli/src/ui/hooks/useExecutionLifecycle.ts +++ b/packages/cli/src/ui/hooks/useExecutionLifecycle.ts @@ -431,6 +431,9 @@ export const useExecutionLifecycle = ( switch (event.type) { case 'raw_data': + // We rely on 'file_data' for the clean output stream. + break; + case 'file_data': if (!isBinaryStream) { outputStream.write(event.chunk); totalBytesWritten += Buffer.byteLength(event.chunk); @@ -679,19 +682,15 @@ export const useExecutionLifecycle = ( if (!outputStream.closed) { outputStream.destroy(); } - if (pwdFilePath && fs.existsSync(pwdFilePath)) { - fs.unlinkSync(pwdFilePath); + if (pwdFilePath) { + fs.promises.unlink(pwdFilePath).catch(() => {}); } dispatch({ type: 'SET_ACTIVE_PTY', pid: null }); setShellInputFocused(false); - if (!fullOutputReturned && fs.existsSync(outputFilePath)) { - try { - fs.unlinkSync(outputFilePath); - } catch { - // Ignore errors during unlink - } + if (!fullOutputReturned) { + fs.promises.unlink(outputFilePath).catch(() => {}); } } };