Skip to content

Commit

Permalink
check stdout/stderr has_text() before .send() gets rid of it
Browse files Browse the repository at this point in the history
  • Loading branch information
jesopo committed Jun 7, 2019
1 parent b1d0785 commit 321bd7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def command(self, server, target, target_str, is_channel, user, command,
command_method = self._command_method(target, server)

ret = False
had_out = False

if hook.kwargs.get("remove_empty", True):
args_split = list(filter(None, args_split))
Expand Down Expand Up @@ -211,15 +212,15 @@ def command(self, server, target, target_str, is_channel, user, command,
stderr.write(str(e))

if not hook.kwargs.get("skip_out", False):
had_out = stdout.has_text() or stderr.has_text()
command_method = self._command_method(target, server)
stdout.send(command_method)
stderr.send(command_method)
target.last_stdout = stdout
target.last_stderr = stderr
ret = new_event.eaten

if (expect_output and message_tags and not stdout.has_text() and
not stderr.has_text()):
if expect_output and message_tags and not had_out:
server.send(utils.irc.protocol.tagmsg(target_str,
{"+draft/typing": "done"}), immediate=True)

Expand Down

0 comments on commit 321bd7a

Please sign in to comment.