import { c as defineEventHandler, r as readBody, e as createError } from '../../_/nitro.mjs';
import { a as activeProcesses } from '../../_/cli.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';

const killScript_post = defineEventHandler(async (event) => {
  var _a;
  const body = await readBody(event);
  if (activeProcesses[body.id]) (_a = activeProcesses[body.id]) == null ? void 0 : _a.kill();
  else throw createError({ statusCode: 400, statusMessage: `Could not find script by id "${body.id}".` });
  return {};
});

export { killScript_post as default };
