@fickydev/pigent 0.1.2 → 0.1.4

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/package.json +1 -1
  2. package/src/cli/run.ts +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fickydev/pigent",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Autonomous multi-agent daemon using Pi as core execution engine.",
package/src/cli/run.ts CHANGED
@@ -241,12 +241,15 @@ async function showLogs(): Promise<void> {
241
241
  }
242
242
 
243
243
  async function systemctl(action: string, nothrow = false, extra?: string): Promise<void> {
244
- const commandArgs = extra ? [action, extra] : [action, `${serviceName}.service`];
245
- const proc = $`systemctl --user ${commandArgs}`;
246
- if (nothrow) {
247
- await proc.nothrow();
248
- } else {
249
- await proc;
244
+ const commandArgs = action === "daemon-reload" ? [action] : extra ? [action, extra] : [action, `${serviceName}.service`];
245
+ const proc = Bun.spawn(["systemctl", "--user", ...commandArgs], {
246
+ stdout: "inherit",
247
+ stderr: "inherit",
248
+ });
249
+ const exitCode = await proc.exited;
250
+
251
+ if (exitCode !== 0 && !nothrow) {
252
+ throw new Error(`systemctl ${commandArgs.join(" ")} failed with exit code ${exitCode}`);
250
253
  }
251
254
  }
252
255