Skip to content

Commit b3c5c9d

Browse files
committed
LSB Error code support for status and exit. Fixes Supervisor#24
* error_status being set in supervisorctl.py raises a SystemExit of that code on exit. * handle_error wraps all error output and sets error_status if not in interactive mode. * onecmd is the entry point for single command and where we enforce SystemExit.
1 parent 304b4f3 commit b3c5c9d

File tree

4 files changed

+334
-122
lines changed

4 files changed

+334
-122
lines changed

supervisor/options.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,7 @@ class ClientOptions(Options):
15791579
username = None
15801580
password = None
15811581
history_file = None
1582+
exit_on_error = None
15821583

15831584
def __init__(self):
15841585
Options.__init__(self, require_configfile=False)
@@ -1591,6 +1592,9 @@ def __init__(self):
15911592
self.configroot.supervisorctl.password = None
15921593
self.configroot.supervisorctl.history_file = None
15931594

1595+
# Set to 0 because it's only activated in realize() if not in interactive mode.
1596+
self.configroot.supervisorctl.exit_on_error = 0
1597+
15941598
from supervisor.supervisorctl import DefaultControllerPlugin
15951599
default_factory = ('default', DefaultControllerPlugin, {})
15961600
# we always add the default factory. If you want to a supervisorctl
@@ -1611,6 +1615,8 @@ def realize(self, *arg, **kw):
16111615
if not self.args:
16121616
self.interactive = 1
16131617

1618+
self.exit_on_error = 0 if self.interactive else 1
1619+
16141620
def read_config(self, fp):
16151621
section = self.configroot.supervisorctl
16161622
need_close = False

0 commit comments

Comments
 (0)