diff --git a/lib/PBot/Core/Applets.pm b/lib/PBot/Core/Applets.pm index 24c273a9..3d9542e0 100644 --- a/lib/PBot/Core/Applets.pm +++ b/lib/PBot/Core/Applets.pm @@ -96,7 +96,9 @@ sub launch_applet($self, $context) { my $start = gettimeofday; $self->{pbot}->{logger}->log("Starting applet run @cmdline\n"); + run \@cmdline, \$stdin, \$stdout, \$stderr, timeout($timeout); + my $duration = sprintf "%0.3f", gettimeofday - $start; $self->{pbot}->{logger}->log("Finished applet run @cmdline; duration: $duration\n"); diff --git a/lib/PBot/Core/Interpreter.pm b/lib/PBot/Core/Interpreter.pm index 20d1eaf8..b7686bdd 100644 --- a/lib/PBot/Core/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -585,9 +585,12 @@ sub interpret($self, $context) { # sends final command output to appropriate queues. # use context result if no result argument given. sub handle_result($self, $context, $result = $context->{result}) { - # condensation of consecutive whitespace is disable by default + # condensation of consecutive whitespace is disabled by default $context->{'condense-whitespace'} //= 0; + # reset interpreted to allow pipes/command-substitutions to finish + delete $context->{'interpreted'}; + # debug flag to trace $context location and contents if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) { use Data::Dumper; diff --git a/lib/PBot/Plugin/Date.pm b/lib/PBot/Plugin/Date.pm index ac73caa0..cd94b038 100644 --- a/lib/PBot/Plugin/Date.pm +++ b/lib/PBot/Plugin/Date.pm @@ -78,23 +78,16 @@ sub cmd_date($self, $context) { return "No timezone set or user account does not exist."; } - # execute `date_applet` - my $newcontext = { - from => $context->{from}, - nick => $context->{nick}, - user => $context->{user}, - host => $context->{host}, - hostmask => $context->{hostmask}, - command => "date_applet $timezone", - root_channel => $context->{from}, - root_keyword => "date_applet", - keyword => "date_applet", - arguments => "$timezone", - }; + # override command fields to execute date_applet + $context->{keyword} = "date_applet"; + $context->{command} = "date_applet $timezone"; + $context->{arguments} = $timezone; + # tell Interpreter::interpret() that this command has been interpreted $context->{interpreted} = 1; - $self->{pbot}->{applets}->execute_applet($newcontext); + # fork to execute applet + $self->{pbot}->{applets}->execute_applet($context); } 1; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 6f6f51a1..4088ec54 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4838, + BUILD_REVISION => 4839, BUILD_DATE => "2024-11-05", };