dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

kill-process.js.map (2422B)


      1 {
      2   "version": 3,
      3   "sources": ["../../src/tools/kill-process.ts"],
      4   "sourcesContent": ["import { exec } from \"child_process\";\nimport { Tool } from \"@raycast/api\";\n\n/**\n * Input type for killing a process\n */\ntype Input = {\n  /**\n   * App name to kill\n   */\n  processName?: string;\n\n  /**\n   * Process ID to kill\n   */\n  id: number;\n\n  /**\n   * Path to the process to kill\n   */\n  path?: string;\n};\n\n/**\n * Kill a process.\n * Provide the process ID to kill.\n * If the process is not found, the tool will return an error.\n */\nexport default async function killProcess(input: Input) {\n  return new Promise((resolve, reject) => {\n    exec(`kill -9 ${input.id}`, (killErr) => {\n      if (killErr) {\n        reject(killErr);\n        return;\n      }\n      resolve(`Killed process: ${input.processName ? input.processName + \" \" : \"\"}(PID: ${input.id})`);\n    });\n  });\n}\n\n/**\n * Because forcibly killing a process can cause data loss or undesired system changes,\n * let's ask for user confirmation before proceeding.\n */\nexport const confirmation: Tool.Confirmation<Input> = async (input: Input) => {\n  const info: { name: string; value: string }[] = [];\n\n  // Only add Process Name if it's provided and non-empty\n  if (input.processName) {\n    info.push({ name: \"Process Name\", value: input.processName });\n  }\n\n  // Always add PID as it's required\n  info.push({ name: \"PID\", value: String(input.id) });\n\n  // Only add Path if it's provided and non-empty\n  if (input.path) {\n    info.push({ name: \"Path\", value: input.path });\n  }\n\n  return { info };\n};\n"],
      5   "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAqB,yBA4BrB,eAAOF,EAAmCG,EAAc,CACtD,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,IACtC,QAAK,WAAWF,EAAM,EAAE,GAAKG,GAAY,CACvC,GAAIA,EAAS,CACXD,EAAOC,CAAO,EACd,MACF,CACAF,EAAQ,mBAAmBD,EAAM,YAAcA,EAAM,YAAc,IAAM,EAAE,SAASA,EAAM,EAAE,GAAG,CACjG,CAAC,CACH,CAAC,CACH,CAMO,IAAMJ,EAAyC,MAAOI,GAAiB,CAC5E,IAAMI,EAA0C,CAAC,EAGjD,OAAIJ,EAAM,aACRI,EAAK,KAAK,CAAE,KAAM,eAAgB,MAAOJ,EAAM,WAAY,CAAC,EAI9DI,EAAK,KAAK,CAAE,KAAM,MAAO,MAAO,OAAOJ,EAAM,EAAE,CAAE,CAAC,EAG9CA,EAAM,MACRI,EAAK,KAAK,CAAE,KAAM,OAAQ,MAAOJ,EAAM,IAAK,CAAC,EAGxC,CAAE,KAAAI,CAAK,CAChB",
      6   "names": ["kill_process_exports", "__export", "confirmation", "killProcess", "__toCommonJS", "import_child_process", "input", "resolve", "reject", "killErr", "info"]
      7 }