# HG changeset patch # User jfp <jf.pieronne@laposte.net> # Date 1685606243 -7200 # Thu Jun 01 09:57:23 2023 +0200 # Node ID c1e2564e721634bfb542266e58bff33232946ad1 # Parent e5b81284892605c8063376fbaaa17feceb767d57 Exit program with the error code return by write to the command mailbox. diff --git a/supervisorctl.py b/supervisorctl.py --- a/supervisorctl.py +++ b/supervisorctl.py @@ -4,7 +4,17 @@ import json from typing import Any, Set, Tuple -from ovms import cmbdef, dvidef, iodef, lnmdef, mbxqio, prvdef, psldef, starlet +from ovms import ( + cmbdef, + crtl, + dvidef, + iodef, + lnmdef, + mbxqio, + prvdef, + psldef, + starlet, +) from ovms.rtl import lib supervisorctl_pwd = '' @@ -48,7 +58,10 @@ cmd['pwd'] = supervisorctl_pwd cmd['mbxreply'] = supervisorctl_mbxreply jscmd = json.dumps(cmd) - self.mcmd.write(jscmd.encode('ascii'), iodef.IO_M_READERCHECK) + try: + self.mcmd.write(jscmd.encode('ascii'), iodef.IO_M_READERCHECK) + except OSError as e: + crtl.vms_exit(e.errno) return json.loads( # self.mcmd_r.read(4096, iodef.IO_M_WRITERCHECK) # type: ignore self.mcmd_r.read(4096) # type: ignore