Skip to content

Commit

Permalink
fix(systemd): fix is-enabled error handling in systemd process manager
Browse files Browse the repository at this point in the history
no issue
- checking for error code doesn't work, better to check error message as that's more consistent
  • Loading branch information
acburdine committed Jul 3, 2017
1 parent 1ef28bf commit ff6cfba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/systemd/systemd.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SystemdProcessManager extends cli.ProcessManager {
execa.shellSync(`systemctl is-enabled ${this.systemdName}`);
return true;
} catch (e) {
// Systemd prints out "disabled" if service isn't enabled
if (!e.message.match(/disabled/)) {
throw e;
}
Expand All @@ -51,9 +52,8 @@ class SystemdProcessManager extends cli.ProcessManager {
execa.shellSync(`systemctl is-active ${this.systemdName}`);
return true;
} catch (e) {
// systemctl is-active returns exit code 3 when a service isn't active,
// so throw if we don't have that.
if (e.code !== 3) {
// Systemd prints out "inactive" if service isn't running
if (!e.message.match(/inactive/)) {
throw e;
}

Expand Down

0 comments on commit ff6cfba

Please sign in to comment.