fix(coding-agent): close bash executor temp streams

closes #3786
This commit is contained in:
Mario Zechner
2026-04-27 20:33:40 +02:00
parent a0d4087037
commit e4f847ff68
2 changed files with 12 additions and 8 deletions

View File

@@ -4,10 +4,12 @@
### Added
- Added `warnings.anthropicExtraUsage` and a `/settings` warnings submenu to suppress the Anthropic extra usage billing warning ([#3808](https://github.com/badlogic/pi-mono/issues/3808))
- Added `ctx.ui.setWorkingVisible()` so extensions can hide the built-in interactive working loader row without reserving layout space, plus a border-status editor example that moves working state into a custom editor border ([#3674](https://github.com/badlogic/pi-mono/issues/3674))
### Fixed
- Fixed bash executor temp output streams leaking file descriptors when output was truncated by line count ([#3786](https://github.com/badlogic/pi-mono/issues/3786))
- Fixed extension `pi.setSessionName()` updates to refresh the interactive terminal title immediately ([#3686](https://github.com/badlogic/pi-mono/issues/3686))
- Fixed `/tree` cancellation via `session_before_tree` leaving the session stuck in compaction state ([#3688](https://github.com/badlogic/pi-mono/issues/3688))
- Fixed Escape interrupt handling when extensions hide the built-in working loader row ([#3674](https://github.com/badlogic/pi-mono/issues/3674))

View File

@@ -110,15 +110,14 @@ export async function executeBashWithOperations(
signal: options?.signal,
});
if (tempFileStream) {
tempFileStream.end();
}
const fullOutput = outputChunks.join("");
const truncationResult = truncateTail(fullOutput);
if (truncationResult.truncated) {
ensureTempFile();
}
if (tempFileStream) {
tempFileStream.end();
}
const cancelled = options?.signal?.aborted ?? false;
return {
@@ -129,10 +128,6 @@ export async function executeBashWithOperations(
fullOutputPath: tempFilePath,
};
} catch (err) {
if (tempFileStream) {
tempFileStream.end();
}
// Check if it was an abort
if (options?.signal?.aborted) {
const fullOutput = outputChunks.join("");
@@ -140,6 +135,9 @@ export async function executeBashWithOperations(
if (truncationResult.truncated) {
ensureTempFile();
}
if (tempFileStream) {
tempFileStream.end();
}
return {
output: truncationResult.truncated ? truncationResult.content : fullOutput,
exitCode: undefined,
@@ -149,6 +147,10 @@ export async function executeBashWithOperations(
};
}
if (tempFileStream) {
tempFileStream.end();
}
throw err;
}
}