Skip to content

Commit ff6cfba

Browse files
committed
fix(systemd): fix is-enabled error handling in systemd process manager
no issue - checking for error code doesn't work, better to check error message as that's more consistent
1 parent 1ef28bf commit ff6cfba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/systemd/systemd.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class SystemdProcessManager extends cli.ProcessManager {
2828
execa.shellSync(`systemctl is-enabled ${this.systemdName}`);
2929
return true;
3030
} catch (e) {
31+
// Systemd prints out "disabled" if service isn't enabled
3132
if (!e.message.match(/disabled/)) {
3233
throw e;
3334
}
@@ -51,9 +52,8 @@ class SystemdProcessManager extends cli.ProcessManager {
5152
execa.shellSync(`systemctl is-active ${this.systemdName}`);
5253
return true;
5354
} catch (e) {
54-
// systemctl is-active returns exit code 3 when a service isn't active,
55-
// so throw if we don't have that.
56-
if (e.code !== 3) {
55+
// Systemd prints out "inactive" if service isn't running
56+
if (!e.message.match(/inactive/)) {
5757
throw e;
5858
}
5959

0 commit comments

Comments
 (0)