From 672a8c9fd96d41e5704e61c6992c0d4ab2340494 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 22 May 2026 15:02:58 +0200 Subject: [PATCH] add print test page v4 --- apply.pl | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/apply.pl b/apply.pl index 24e7d6b..8e122ce 100644 --- a/apply.pl +++ b/apply.pl @@ -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