@getdial/cli 0.13.0 → 0.13.1

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.
@@ -8,6 +8,20 @@ function isSystemctlNotLoaded(err) {
8
8
  const text = stderr ? stderr.toString() : "";
9
9
  return /not loaded|does not exist|Unit .* not found/i.test(text);
10
10
  }
11
+ /**
12
+ * True when the error means systemd simply isn't usable here — no systemctl on
13
+ * PATH, or no user session bus (sandbox / container / CI / non-systemd distro).
14
+ * These are expected on many machines, so they should be logged at debug, not
15
+ * dumped as a scary warning with a full stack trace.
16
+ */
17
+ function isSystemdUnavailable(err) {
18
+ const e = err;
19
+ if (e.code === "ENOENT")
20
+ return true; // systemctl / loginctl not installed
21
+ const stderr = e.stderr ? e.stderr.toString() : "";
22
+ const text = stderr || e.message || "";
23
+ return /Failed to connect to bus|No medium found|XDG_RUNTIME_DIR|not been booted with systemd|Connection refused|Permission denied/i.test(text);
24
+ }
11
25
  function isEnoent(err) {
12
26
  return err.code === "ENOENT";
13
27
  }
@@ -74,7 +88,11 @@ export function systemctlStatus() {
74
88
  return { running: active, pid: active && pid > 0 ? pid : null };
75
89
  }
76
90
  catch (err) {
77
- logger.warn({ err }, "systemctl show failed");
91
+ // Expected on machines without a systemd user session — stay quiet there.
92
+ if (isSystemdUnavailable(err))
93
+ logger.debug({ err }, "systemd not available; treating listen service as not running");
94
+ else
95
+ logger.warn({ err }, "systemctl show failed");
78
96
  return { running: false, pid: null };
79
97
  }
80
98
  }
@@ -84,7 +102,10 @@ export function lingerEnabled(user) {
84
102
  return /Linger=yes/.test(out);
85
103
  }
86
104
  catch (err) {
87
- logger.warn({ err, user }, "loginctl show-user failed; assuming linger disabled");
105
+ if (isSystemdUnavailable(err))
106
+ logger.debug({ err, user }, "loginctl unavailable; assuming linger disabled");
107
+ else
108
+ logger.warn({ err, user }, "loginctl show-user failed; assuming linger disabled");
88
109
  return false;
89
110
  }
90
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getdial/cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Dial CLI — install, sign up, and run the local listen service.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/skills.tar.gz CHANGED
Binary file