Code review fix.

This commit is contained in:
jacob314
2026-02-26 14:54:29 -08:00
parent 7eb6d78f93
commit c61bef6789

View File

@@ -350,6 +350,9 @@ export const useShellCommandProcessor = (
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);
@@ -555,19 +558,15 @@ export const useShellCommandProcessor = (
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(() => {});
}
}
};