Skip to content

Commit 5f1e153

Browse files
authored
Add pid validation guard for inline termination script
1 parent f106cc9 commit 5f1e153

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

client/src/node/processes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export function terminate(process: ChildProcess & { pid: number }, cwd?: string)
2929
} else if (isLinux || isMacintosh) {
3030
try {
3131
const pid = process.pid.toString();
32+
if (!/^\d+$/.test(pid)) {
33+
return false;
34+
}
3235
const script = `
3336
terminateTree() {
3437
for cpid in $(pgrep -P "$1"); do

0 commit comments

Comments
 (0)