diff --git a/src/Netscript/killWorkerScript.ts b/src/Netscript/killWorkerScript.ts index 1a620f2a0..076a7528b 100644 --- a/src/Netscript/killWorkerScript.ts +++ b/src/Netscript/killWorkerScript.ts @@ -8,20 +8,12 @@ import { workerScripts } from "./WorkerScripts"; import { GetAllServers, GetServer } from "../Server/AllServers"; import { AddRecentScript } from "./RecentScripts"; -import { ITutorial } from "../InteractiveTutorial"; -import { AlertEvents } from "../ui/React/AlertManager"; import { handleUnknownError } from "../utils/ErrorHandler"; import { roundToTwo } from "../utils/helpers/roundToTwo"; import { BaseServer } from "../Server/BaseServer"; -export function killWorkerScript(ws: WorkerScript): boolean { - if (ITutorial.isRunning) { - AlertEvents.emit("Processes cannot be killed during the tutorial."); - return false; - } +export function killWorkerScript(ws: WorkerScript): void { stopAndCleanUpWorkerScript(ws); - - return true; } export function killWorkerScriptByPid(pid: number, killer?: WorkerScript): boolean { diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index b9cdb0ae6..5cbe10ebe 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -675,18 +675,15 @@ export const ns: InternalAPI = { } helpers.log(ctx, () => "About to exit..."); - const killed = killWorkerScript(ctx.workerScript); + killWorkerScript(ctx.workerScript); if (runOpts.spawnDelay === 0) { helpers.log(ctx, () => `Executing '${path}' immediately`); spawnCb(); } - - if (killed) { - // This prevents error messages about statements after the spawn() - // trying to be executed when the script is dead. - throw new ScriptDeath(ctx.workerScript); - } + // This prevents error messages about statements after the spawn() + // trying to be executed when the script is dead. + throw new ScriptDeath(ctx.workerScript); }, self: (ctx) => () => { const runningScript = helpers.getRunningScript(ctx, ctx.workerScript.pid);