From c3e16410c238eaa876cbbb0704c8781e01f5df9a Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 7 Sep 2021 10:18:12 -0700 Subject: [PATCH] Whoops, execute_process() cannot return undef If ProcessManager::execute_process() returns undef, then the loop in Interpreter::interpret() thinks that the command didn't get handled, and so goes on to look for other commands. This is now corrected. --- lib/PBot/Core/Interpreter.pm | 4 ++-- lib/PBot/Core/ProcessManager.pm | 4 ++-- lib/PBot/VERSION.pm | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PBot/Core/Interpreter.pm b/lib/PBot/Core/Interpreter.pm index 5d3307b3..ae089a98 100644 --- a/lib/PBot/Core/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -550,11 +550,11 @@ sub interpret { sub handle_result { my ($self, $context, $result) = @_; - # if passed, allow $result parameter to override contextual result + # use context result if no result argument given $result //= $context->{result}; # ensure we have a command result to work with - return if not defined $result; + return if not defined $result or not length $result; # preservation of consecutive whitespace is disabled by default $context->{preserve_whitespace} //= 0; diff --git a/lib/PBot/Core/ProcessManager.pm b/lib/PBot/Core/ProcessManager.pm index 0ab7e081..e7043f21 100644 --- a/lib/PBot/Core/ProcessManager.pm +++ b/lib/PBot/Core/ProcessManager.pm @@ -143,8 +143,8 @@ sub execute_process { # add reader handler $self->{pbot}->{select_handler}->add_reader($reader, sub { $self->process_pipe_reader($context->{pid}, @_) }); - # return undef since reader will handle the output when child is finished - return undef; + # return empty string since reader will handle the output when child is finished + return ''; } } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 635d039c..9c34f4be 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4377, - BUILD_DATE => "2021-09-06", + BUILD_REVISION => 4381, + BUILD_DATE => "2021-09-07", }; sub initialize {}