diff --git a/LoadCSVData.pl b/LoadCSVData.pl index e21b7a6..9a44020 100755 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -135,15 +135,12 @@ sub matlabCalc { #print $ENV{"HOME"} . "\n"; $ENV{"HOME"} = "/" . $ENV{"HOME"}; - #chdir($matlab_func_dir) - # or die "cannot change: $!\n"; + chdir($matlab_func_dir) + or die "cannot change: $!\n"; print getTimeStamp("log") . " - pid $$ >> current dir: $matlab_func_dir\n"; - my @args = ( - 'cd', $matlab_func_dir, '; timeout', $matlab_timeout, - $matlab_cmd, $matlab_rt, $unit, $tool - ); - if ( system(@args) != 0 ) { + my $args = "timeout $matlab_timeout $matlab_cmd $matlab_rt $unit $tool"; + if ( system($args) != 0 ) { open( my $fh, '<', $MatlabErrorFilename ) or warn print getTimeStamp("log") . " - pid $$ >> Cannot open Matlab output error file: ${MatlabErrorFilename}\n"; @@ -160,13 +157,13 @@ sub matlabCalc { if ( $exit_value == 124 ) { print getTimeStamp("log") - . " - pid $$ >> system @args excessive duration: killed after $matlab_timeout seconds\n"; + . " - pid $$ >> system $args excessive duration: killed after $matlab_timeout seconds\n"; $matlab_error = "Matlab elab excessive duration: killed after $matlab_timeout seconds"; } else { print getTimeStamp("log") - . " - pid $$ >> system @args failed: return code $exit_value - $?\n"; + . " - pid $$ >> system $args failed: return code $exit_value - $?\n"; $matlab_error = "Matlab elab failed: $exit_value - $?"; } makeEmailMsg();