DOC: Improve ns.kill documentation (#365)

This commit is contained in:
Snarling
2023-02-13 21:50:38 -05:00
committed by GitHub
parent 571f1eb8ef
commit b0bdf0c7ad
5 changed files with 53 additions and 116 deletions
+2 -2
View File
@@ -740,7 +740,7 @@ export const ns: InternalAPI<NSFull> = {
},
kill:
(ctx) =>
(scriptID, hostname?, ...scriptArgs) => {
(scriptID, hostname = ctx.workerScript.hostname, ...scriptArgs) => {
const ident = helpers.scriptIdentifier(ctx, scriptID, hostname, scriptArgs);
let res;
const killByPid = typeof ident === "number";
@@ -749,7 +749,7 @@ export const ns: InternalAPI<NSFull> = {
res = killWorkerScript(ident);
} else {
// Kill by filename/hostname
if (scriptID === undefined || hostname === undefined) {
if (scriptID === undefined) {
throw helpers.makeRuntimeErrorMsg(ctx, "Usage: kill(scriptname, server, [arg1], [arg2]...)");
}