Skip to content

Commit 56146af

Browse files
committed
TaskRunProcessProvider cleanup is async
1 parent 020565c commit 56146af

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/cli-v3/src/entryPoints/managed/controller.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ export class ManagedRunController {
417417
});
418418

419419
this.currentExecution?.kill().catch(() => {});
420-
this.taskRunProcessProvider.cleanup();
420+
this.taskRunProcessProvider.cleanup().catch(() => {});
421421

422422
process.exit(code);
423423
}
@@ -558,7 +558,15 @@ export class ManagedRunController {
558558
}
559559

560560
// Cleanup the task run process provider
561-
this.taskRunProcessProvider.cleanup();
561+
const [cleanupError] = await tryCatch(this.taskRunProcessProvider.cleanup());
562+
563+
if (cleanupError) {
564+
this.sendDebugLog({
565+
runId: this.runFriendlyId,
566+
message: "Error during task run process provider cleanup",
567+
properties: { error: String(cleanupError) },
568+
});
569+
}
562570

563571
// Close the socket
564572
this.socket.close();

packages/cli-v3/src/entryPoints/managed/taskRunProcessProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ export class TaskRunProcessProvider {
162162
/**
163163
* Forces cleanup of any persistent process
164164
*/
165-
cleanup(): void {
165+
async cleanup() {
166166
if (this.persistentProcess) {
167167
this.sendDebugLog("cleanup() called");
168168

169-
this.cleanupProcess(this.persistentProcess);
169+
await this.cleanupProcess(this.persistentProcess);
170170
}
171171
}
172172

0 commit comments

Comments
 (0)