add print test page v4

This commit is contained in:
Mario Fetka
2026-05-22 15:02:58 +02:00
parent 04275ca1a7
commit 672a8c9fd9

View File

@@ -1607,6 +1607,7 @@ sub run_queue_test_command( @ )
my $output = '';
my $tmpdir = '/run/mars-nwe-webui';
my $out;
my $shell;
my $rc;
$queue_test_command_rc = 0;
@@ -1614,24 +1615,17 @@ sub run_queue_test_command( @ )
$tmpdir = '/tmp' if ! -d $tmpdir || ! -w $tmpdir;
$out = $tmpdir . '/smart-test-print-output-' . $$ . '-' . int( rand( 1000000 ) ) . '.txt';
$rc = system( @cmd, '>', $out, '2>&1' );
# system(@list) does not process shell redirection. If the platform did
# not create an output file, fall back to a shell command with fully quoted
# arguments only for capturing output.
if( ! -e $out )
{
my $shell = join( ' ', map { queue_test_shell_log_quote( $_ ) } @cmd ) . ' > ' . queue_test_shell_log_quote( $out ) . ' 2>&1';
$rc = system( $shell );
}
$shell = join( ' ', map { queue_test_shell_log_quote( $_ ) } @cmd ) .
' > ' . queue_test_shell_log_quote( $out ) . ' 2>&1';
$rc = system( $shell );
$queue_test_command_rc = $rc;
if( open( my $fh, '<', $out ) )
if( open( my $ofh, '<', $out ) )
{
local $/ = undef;
$output = <$fh>;
close( $fh );
$output = <$ofh>;
close( $ofh );
unlink( $out );
}
else