Skip to content

Commit 896a29f

Browse files
committed
chore(compas): prevent zombie processes
1 parent 4c4420a commit 896a29f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/.vitepress/theme/custom.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
--vp-c-green-2: #34d399;
44
--vp-c-green-3: #6ee7b7;
55
--vp-c-green-soft: rgba(16, 185, 129, 0.14);
6-
76
}
87

98
.dark {

packages/compas/src/main/development/integrations/actions.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,19 @@ export class ActionsIntegration extends BaseIntegration {
2727
* command: string[],
2828
* workingDirectory: string,
2929
* startTime: number,
30-
* boundResetState: () => void,
3130
* }}
3231
*/
3332
this.activeProcess = undefined;
3433

34+
const exitHandler = () => {
35+
if (this.activeProcess?.cp) {
36+
// @ts-expect-error
37+
process.kill(this.activeProcess.cp.pid);
38+
}
39+
};
40+
41+
process.once("exit", exitHandler);
42+
3543
this.setActionsGroups();
3644

3745
if (this.state.screen.state === "idle") {
@@ -201,12 +209,11 @@ export class ActionsIntegration extends BaseIntegration {
201209
cwd: action.workingDirectory,
202210
stdio: ["ignore", "inherit", "inherit"],
203211
}),
204-
boundResetState: this.resetState.bind(this),
205212
};
206213

207214
// Separate listeners for screen reset and user information
208215
this.activeProcess.cp.once("exit", this.onActionExit.bind(this));
209-
this.activeProcess.cp.once("exit", this.activeProcess.boundResetState);
216+
this.activeProcess.cp.once("exit", this.resetState.bind(this));
210217
}
211218

212219
async killAction() {

0 commit comments

Comments
 (0)