]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
general-functions.pl: Read output first before we wait for the process to terminate
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 16 Oct 2025 16:40:08 +0000 (18:40 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 16 Oct 2025 16:40:08 +0000 (18:40 +0200)
When generating IPS reports, the reporter could not write to the output,
therefore blocked and the CGI script timed out.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index 94d0e74406de2b0441b8c4333cbff4c78b61b227..1c3374d867ffb79120ccf55906eb28eb5e06dc2c 100644 (file)
@@ -66,13 +66,13 @@ sub system_output($) {
                die "Could not execute @command: $!";
        }
 
-       waitpid($pid, 0);
-
        while (<OUTPUT>) {
                push(@output, $_);
        }
        close(OUTPUT);
 
+       waitpid($pid, 0);
+
        return @output;
 }