NETSCRIPT: Log script kill immediately and identify the killing script. (#1907)

This commit is contained in:
Yichi Zhang
2025-01-12 21:07:01 -08:00
committed by GitHub
parent 0e8dca85e1
commit e6a1c344d3
3 changed files with 7 additions and 6 deletions
+4 -4
View File
@@ -811,7 +811,7 @@ export const ns: InternalAPI<NSFull> = {
const killByPid = typeof ident === "number";
if (killByPid) {
// Kill by pid
res = killWorkerScriptByPid(ident);
res = killWorkerScriptByPid(ident, ctx.workerScript);
} else {
// Kill by filename/hostname
if (scriptID === undefined) {
@@ -826,7 +826,7 @@ export const ns: InternalAPI<NSFull> = {
res = true;
for (const pid of byPid.keys()) {
res &&= killWorkerScriptByPid(pid);
res &&= killWorkerScriptByPid(pid, ctx.workerScript);
}
}
@@ -861,7 +861,7 @@ export const ns: InternalAPI<NSFull> = {
for (const byPid of server.runningScriptMap.values()) {
for (const pid of byPid.keys()) {
if (safetyGuard && pid == ctx.workerScript.pid) continue;
killWorkerScriptByPid(pid);
killWorkerScriptByPid(pid, ctx.workerScript);
++scriptsKilled;
}
}
@@ -1494,7 +1494,7 @@ export const ns: InternalAPI<NSFull> = {
if (!pattern.test(key)) continue;
suc = true;
for (const pid of byPid.keys()) {
killWorkerScriptByPid(pid);
killWorkerScriptByPid(pid, ctx.workerScript);
}
}
return suc;