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,15 +237,16 @@ 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()
command_method = self._command_method(target, server) if has_out:
stdout.send(command_method) command_method = self._command_method(target, server)
stderr.send(command_method) stdout.send(command_method)
target.last_stdout = stdout stderr.send(command_method)
target.last_stderr = stderr target.last_stdout = stdout
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)