only set last_stdout/last_stderr when there's actually output

This commit is contained in:
jesopo 2019-07-07 11:29:22 +01:00
parent cd0a860f5f
commit 84df0cb054

View file

@ -189,7 +189,7 @@ class Module(ModuleManager.BaseModule):
command_method = self._command_method(target, server) command_method = self._command_method(target, server)
ret = False ret = False
had_out = False has_out = False
if hook.get_kwarg("remove_empty", True): if hook.get_kwarg("remove_empty", True):
args_split = list(filter(None, args_split)) args_split = list(filter(None, args_split))
@ -237,7 +237,8 @@ class Module(ModuleManager.BaseModule):
return True return True
if not hook.get_kwarg("skip_out", False): if not hook.get_kwarg("skip_out", False):
had_out = stdout.has_text() or stderr.has_text() has_out = stdout.has_text() or stderr.has_text()
if has_out:
command_method = self._command_method(target, server) command_method = self._command_method(target, server)
stdout.send(command_method) stdout.send(command_method)
stderr.send(command_method) stderr.send(command_method)
@ -245,7 +246,7 @@ class Module(ModuleManager.BaseModule):
target.last_stderr = stderr target.last_stderr = stderr
ret = new_event.eaten ret = new_event.eaten
if expect_output and message_tags and not had_out: if expect_output and message_tags and not has_out:
server.send(utils.irc.protocol.tagmsg(target_str, server.send(utils.irc.protocol.tagmsg(target_str,
{"+draft/typing": "done"}), immediate=True) {"+draft/typing": "done"}), immediate=True)