From 03fb90129103b111708fc27335f3fbfd0cb69ac4 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 31 Mar 2022 19:52:46 -0700 Subject: [PATCH] pbot-vm: fix potential time-out when outputting 0 If the output from a code snippet is `0` without a newline, Perl treats this as a false value. When Guest::process_command() returns a false value, that signals to guest-server::serial_server() that it is the parent returning and so it will not send the result back to the host. However, `0\n` is a true value. Solution: always append a final newline to the guest output. --- applets/pbot-vm/guest/lib/Guest.pm | 2 +- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applets/pbot-vm/guest/lib/Guest.pm b/applets/pbot-vm/guest/lib/Guest.pm index 433df93c..914a4504 100644 --- a/applets/pbot-vm/guest/lib/Guest.pm +++ b/applets/pbot-vm/guest/lib/Guest.pm @@ -116,7 +116,7 @@ sub process_command($command, $mod, $user, $tag) { print STDERR "=" x 40, "\n"; - return $result; + return "$result\n"; } else { # wait for child to finish waitpid($pid, 0); diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index bbdae713..d5658280 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 => 4518, - BUILD_DATE => "2022-03-23", + BUILD_REVISION => 4520, + BUILD_DATE => "2022-03-31", }; sub initialize {}