script: tweak explicit command invocation

This commit is contained in:
Aldo Cortesi 2018-05-12 13:06:08 +12:00
parent 33eba29d1e
commit 94428b2ffd
2 changed files with 5 additions and 8 deletions

View file

@ -155,9 +155,9 @@ class ScriptLoader:
if not os.path.isfile(path):
ctx.log.error('No such script: %s' % path)
return
try:
mod = load_script(path)
if mod:
mod = load_script(path)
if mod:
with addonmanager.safecall():
ctx.master.addons.invoke_addon(mod, "running")
ctx.master.addons.invoke_addon(
mod,
@ -166,10 +166,7 @@ class ScriptLoader:
)
for f in flows:
for evt, arg in eventsequence.iterate(f):
with addonmanager.safecall():
ctx.master.addons.invoke_addon(mod, evt, arg)
except exceptions.OptionsError as e:
script_error_handler(path, e, msg=str(e))
ctx.master.addons.invoke_addon(mod, evt, arg)
def configure(self, updated):
if "scripts" in updated:

View file

@ -586,7 +586,7 @@ class TCPServer:
with self.handler_counter:
try:
self.handle_client_connection(connection, client_address)
except OSError as e:
except OSError as e: # pragma: no cover
# This catches situations where the underlying connection is
# closed beneath us. Syscalls on the connection object at this
# point returns EINVAL. If this happens, we close the socket and