@1mancompany/onemancompany 0.2.244 → 0.2.246

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.
Files changed (2) hide show
  1. package/bin/cli.js +21 -4
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -83,21 +83,38 @@ function isProcessRunning(pid) {
83
83
  }
84
84
  }
85
85
 
86
+ function killProcessGroup(pid, signal) {
87
+ if (isWindows) {
88
+ // Windows: use taskkill to kill process tree
89
+ try {
90
+ execSync(`taskkill /PID ${pid} /T /F`, { stdio: "ignore" });
91
+ } catch {}
92
+ } else {
93
+ // Unix: kill the entire process group (negative PID)
94
+ try {
95
+ process.kill(-pid, signal);
96
+ } catch {
97
+ // Fallback to single process kill
98
+ try { process.kill(pid, signal); } catch {}
99
+ }
100
+ }
101
+ }
102
+
86
103
  function stopService(installDir) {
87
104
  const pid = readPidFile(installDir);
88
105
  if (pid && isProcessRunning(pid)) {
89
- info(`Stopping OneManCompany service (PID ${pid})...`);
106
+ info(`Stopping OneManCompany service (PID ${pid}) and all child processes...`);
90
107
  try {
91
- process.kill(pid, "SIGTERM");
108
+ killProcessGroup(pid, "SIGTERM");
92
109
  // Wait up to 5s for graceful shutdown
93
110
  for (let i = 0; i < 50; i++) {
94
111
  if (!isProcessRunning(pid)) break;
95
112
  spawnSync("sleep", ["0.1"]);
96
113
  }
97
114
  if (isProcessRunning(pid)) {
98
- process.kill(pid, "SIGKILL");
115
+ killProcessGroup(pid, "SIGKILL");
99
116
  }
100
- info("Service stopped");
117
+ info("Service and all child processes stopped");
101
118
  } catch {
102
119
  warn("Could not stop service — it may have already exited");
103
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1mancompany/onemancompany",
3
- "version": "0.2.244",
3
+ "version": "0.2.246",
4
4
  "description": "The AI Operating System for One-Person Companies",
5
5
  "bin": {
6
6
  "onemancompany": "bin/cli.js"