3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 04:22:35 +01:00

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.
This commit is contained in:
Pragmatic Software 2021-09-07 10:18:12 -07:00
parent 7e539cc633
commit c3e16410c2
3 changed files with 6 additions and 6 deletions

View File

@ -550,11 +550,11 @@ sub interpret {
sub handle_result { sub handle_result {
my ($self, $context, $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}; $result //= $context->{result};
# ensure we have a command result to work with # 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 # preservation of consecutive whitespace is disabled by default
$context->{preserve_whitespace} //= 0; $context->{preserve_whitespace} //= 0;

View File

@ -143,8 +143,8 @@ sub execute_process {
# add reader handler # add reader handler
$self->{pbot}->{select_handler}->add_reader($reader, sub { $self->process_pipe_reader($context->{pid}, @_) }); $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 empty string since reader will handle the output when child is finished
return undef; return '';
} }
} }

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4377, BUILD_REVISION => 4381,
BUILD_DATE => "2021-09-06", BUILD_DATE => "2021-09-07",
}; };
sub initialize {} sub initialize {}