TaskRunProcessProvider cleanup is async

This commit is contained in:
Eric Allam
2025-06-18 16:16:38 +01:00
parent 020565c009
commit 56146afcb6
2 changed files with 12 additions and 4 deletions
@@ -417,7 +417,7 @@ export class ManagedRunController {
});
this.currentExecution?.kill().catch(() => {});
this.taskRunProcessProvider.cleanup();
this.taskRunProcessProvider.cleanup().catch(() => {});
process.exit(code);
}
@@ -558,7 +558,15 @@ export class ManagedRunController {
}
// Cleanup the task run process provider
this.taskRunProcessProvider.cleanup();
const [cleanupError] = await tryCatch(this.taskRunProcessProvider.cleanup());
if (cleanupError) {
this.sendDebugLog({
runId: this.runFriendlyId,
message: "Error during task run process provider cleanup",
properties: { error: String(cleanupError) },
});
}
// Close the socket
this.socket.close();
@@ -162,11 +162,11 @@ export class TaskRunProcessProvider {
/**
* Forces cleanup of any persistent process
*/
cleanup(): void {
async cleanup() {
if (this.persistentProcess) {
this.sendDebugLog("cleanup() called");
this.cleanupProcess(this.persistentProcess);
await this.cleanupProcess(this.persistentProcess);
}
}