@plumpslabs/fennec-cli 1.13.5 → 1.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2091,7 +2091,7 @@ function hexColor(color) {
2091
2091
  }
2092
2092
  var fennecOrange2 = hexColor("#FF6432");
2093
2093
  var fennecGold = hexColor("#FFB347");
2094
- var VERSION = "1.13.5";
2094
+ var VERSION = "1.13.6";
2095
2095
  var cachedBanner = null;
2096
2096
  var cachedCompact = null;
2097
2097
  function generateBanner() {
@@ -4216,8 +4216,9 @@ async function killCommand(args2) {
4216
4216
  const signalIndex = args2.indexOf("--signal");
4217
4217
  const signalRaw = signalIndex !== -1 ? args2[signalIndex + 1] : "SIGTERM";
4218
4218
  const signal = signalRaw ?? "SIGTERM";
4219
+ const force = args2.includes("-y") || args2.includes("--yes");
4219
4220
  if (rawTarget === "all" || args2.includes("--all") || args2.includes("-a")) {
4220
- await killAll(signal);
4221
+ await killAll(signal, force);
4221
4222
  return;
4222
4223
  }
4223
4224
  if (!rawTarget) {
@@ -4271,7 +4272,6 @@ async function killCommand(args2) {
4271
4272
  }
4272
4273
  }
4273
4274
  }
4274
- const force = args2.includes("-y") || args2.includes("--yes");
4275
4275
  const confirmed = force || await confirmPrompt(`Kill ${pc8.bold(displayName)} with ${pc8.yellow(signal)}?`, false);
4276
4276
  if (!confirmed) {
4277
4277
  console.error(` ${pc8.dim("Cancelled")}`);
@@ -4304,36 +4304,35 @@ async function killCommand(args2) {
4304
4304
  console.error(renderError("Permission denied", "Try running with sudo or use a different signal."));
4305
4305
  }
4306
4306
  }
4307
- async function killAll(signal) {
4308
- const userProcs = getSystemProcesses({ userOnly: true, sortBy: "cpu", limit: 200 });
4309
- if (userProcs.length === 0) {
4310
- console.error(` ${pc8.dim("No user processes to kill.")}`);
4307
+ async function killAll(signal, force) {
4308
+ const tracked = readTracked();
4309
+ const running = tracked.filter((t) => isTrackedRunning(t));
4310
+ if (running.length === 0) {
4311
+ console.error(` ${pc8.dim("No running tracked apps to kill.")}`);
4311
4312
  return;
4312
4313
  }
4313
4314
  console.error(`
4314
- ${pc8.bold(`Kill ${userProcs.length} user processes?`)}`);
4315
- console.error(` ${pc8.dim("This will stop ALL your running processes.")}`);
4316
- console.error(` ${pc8.yellow("\u26A0 System processes will not be affected.")}
4315
+ ${pc8.bold(`Kill ${running.length} tracked app(s)?`)}`);
4316
+ console.error(` ${pc8.dim("This stops every Fennec-tracked running process only \u2014 other processes are untouched.")}
4317
4317
  `);
4318
- const confirmed = await confirmPrompt(`${pc8.red("Are you sure?")} ${pc8.dim("This cannot be undone")}`, false);
4318
+ const confirmed = force || await confirmPrompt(`${pc8.red("Are you sure?")} ${pc8.dim("This cannot be undone")}`, false);
4319
4319
  if (!confirmed) {
4320
4320
  console.error(` ${pc8.dim("Cancelled.")}`);
4321
4321
  return;
4322
4322
  }
4323
- const spinner = createSpinner(`Killing ${userProcs.length} processes...`);
4323
+ const spinner = createSpinner(`Killing ${running.length} tracked app(s)...`);
4324
4324
  let killed = 0, failed = 0;
4325
- for (const proc of userProcs) {
4326
- if (killProcess(proc.pid, signal)) {
4325
+ for (const t of running) {
4326
+ if (killProcess(t.pid, signal)) {
4327
4327
  killed++;
4328
- removeTrackedByPid(proc.pid);
4328
+ removeTrackedByPid(t.pid);
4329
4329
  } else {
4330
4330
  failed++;
4331
4331
  }
4332
- if (killed % 10 === 0) await new Promise((r) => setTimeout(r, 50));
4333
4332
  }
4334
- await new Promise((r) => setTimeout(r, 500));
4335
- killed > 0 ? spinner.succeed(`${killed} process(es) killed`) : spinner.fail("Failed to kill processes");
4336
- if (failed > 0) console.error(` ${pc8.yellow(`${failed} process(es) could not be killed`)} ${pc8.dim("(try with sudo)")}`);
4333
+ await new Promise((r) => setTimeout(r, 300));
4334
+ killed > 0 ? spinner.succeed(`${killed} tracked app(s) killed`) : spinner.fail("Failed to kill apps");
4335
+ if (failed > 0) console.error(` ${pc8.yellow(`${failed} app(s) could not be killed`)}`);
4337
4336
  }
4338
4337
 
4339
4338
  // src/commands/stop.ts