@@ -1427,21 +1427,21 @@ algorithm
14271427
14281428 result_file := selectResultFile(result_file, simflags);
14291429
1430- executableSuffixedExe := stringAppend(executable, getSimulationExtension(Config . simCodeTarget(),Autoconf . platform));
1431- logFile := stringAppend(executable,".log" );
1432- // adrpo: log file is deleted by buildModel! do NOT DELETE IT AGAIN!
1433- // we should really have different log files for simulation/compilation!
1434- // as the buildModel log file will be deleted here and that gives less information to the user!
1435- if System . regularFileExists(logFile) then
1436- 0 := System . removeFile(logFile);
1437- end if ;
1438- sim_call := stringAppendList({" \" " ,exeDir,executableSuffixedExe," \" " ," " ,simflags});
1439- System . realtimeTick(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
1440- SimulationResults . close() "Windows cannot handle reading and writing to the same file from different processes like any real OS :(" ;
1441-
1442- resI := System . systemCall (sim_call, logFile);
1443-
1444- timeSimulation := System . realtimeTock(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
1430+ executableSuffixedExe := stringAppend(executable, getSimulationExtension(Config . simCodeTarget(),Autoconf . platform));
1431+ logFile := stringAppend(executable,".log" );
1432+ // adrpo: log file is deleted by buildModel! do NOT DELETE IT AGAIN!
1433+ // we should really have different log files for simulation/compilation!
1434+ // as the buildModel log file will be deleted here and that gives less information to the user!
1435+ if System . regularFileExists(logFile) then
1436+ 0 := System . removeFile(logFile);
1437+ end if ;
1438+ sim_call := stringAppendList({" \" " ,exeDir,executableSuffixedExe," \" " ," " ,simflags});
1439+ System . realtimeTick(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
1440+ SimulationResults . close() "Windows cannot handle reading and writing to the same file from different processes like any real OS :(" ;
1441+
1442+ resI := System . systemCallRestrictedEnv (sim_call, logFile);
1443+
1444+ timeSimulation := System . realtimeTock(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
14451445
14461446 else
14471447 result_file := "" ;
@@ -1537,7 +1537,7 @@ algorithm
15371537 System . realtimeTick(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
15381538 SimulationResults . close() "Windows cannot handle reading and writing to the same file from different processes like any real OS :(" ;
15391539
1540- if 0 == System . systemCall (sim_call, logFile) then
1540+ if 0 == System . systemCallRestrictedEnv (sim_call, logFile) then
15411541 result_file = stringAppendList(List . consOnTrue(not Testsuite . isRunning(),compileDir,{executable,"_res." ,outputFormat_str}));
15421542 timeSimulation = System . realtimeTock(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
15431543 timeTotal = System . realtimeTock(ClockIndexes . RT_CLOCK_SIMULATE_TOTAL );
@@ -1601,7 +1601,7 @@ algorithm
16011601 sim_call = stringAppendList({" \" " ,exeDir,executableSuffixedExe," \" " ," " ,simflags});
16021602 System . realtimeTick(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
16031603 SimulationResults . close() "Windows cannot handle reading and writing to the same file from different processes like any real OS :(" ;
1604- resI = System . systemCall (sim_call, logFile);
1604+ resI = System . systemCallRestrictedEnv (sim_call, logFile);
16051605 timeSimulation = System . realtimeTock(ClockIndexes . RT_CLOCK_SIMULATE_SIMULATION );
16061606 else
16071607 result_file = "" ;
@@ -3730,7 +3730,7 @@ algorithm
37303730 cmakeCall + " && " +
37313731 Autoconf . cmake + " --build . --parallel " + getProcsStr() + " --target install && " +
37323732 "cd .. && rm -rf " + buildDir;
3733- if 0 <> System . systemCall (cmd, outFile= logfile) then
3733+ if 0 <> System . systemCallRestrictedEnv (cmd, outFile= logfile) then
37343734 Error . addMessage(Error . SIMULATOR_BUILD_ERROR , {"cmd: " + cmd + " \n " + System . readFile(logfile)});
37353735 fail();
37363736 end if ;
@@ -3749,7 +3749,7 @@ algorithm
37493749 cmakeCall + " && " +
37503750 Autoconf . cmake + " --build . --parallel " + getProcsStr() + " --target install && " +
37513751 "cd .. && rm -rf " + buildDir;
3752- if 0 <> System . systemCall (cmd, outFile= logfile) then
3752+ if 0 <> System . systemCallRestrictedEnv (cmd, outFile= logfile) then
37533753 Error . addMessage(Error . SIMULATOR_BUILD_ERROR , {"cmd: " + cmd + " \n " + System . readFile(logfile)});
37543754 fail();
37553755 end if ;
@@ -3986,7 +3986,7 @@ algorithm
39863986 cmd := "cd \" " + fmutmp + "/sources \" && ./configure --host=" + quote+ platform+ quote+
39873987 " CFLAGS=" + quote + "-Os" + quote + " CPPFLAGS=" + quote + CPPFLAGS + quote+
39883988 " LDFLAGS= && " + nozip;
3989- if 0 <> System . systemCall (cmd, outFile= logfile) then
3989+ if 0 <> System . systemCallRestrictedEnv (cmd, outFile= logfile) then
39903990 Error . addMessage(Error . SIMULATOR_BUILD_ERROR , {System . readFile(logfile)});
39913991 System . removeFile(logfile);
39923992 fail();
@@ -4076,7 +4076,7 @@ algorithm
40764076 ExecStat . execStat("buildModelFMU: configured platform " + platform + " using " + cmd);
40774077 if not finishedBuild then
40784078 if not isWindows then
4079- if 0 <> System . systemCall ("cd " + dir + " && " + Autoconf . make + " clean > /dev/null 2>&1" ) then
4079+ if 0 <> System . systemCallRestrictedEnv ("cd " + dir + " && " + Autoconf . make + " clean > /dev/null 2>&1" ) then
40804080 Error . addMessage(Error . SIMULATOR_BUILD_ERROR , {"Failed to make clean" });
40814081 fail();
40824082 end if ;
@@ -4353,7 +4353,7 @@ algorithm
43534353 end if ;
43544354 ExecStat . execStat("buildModelFMU: Generate C++ for platform " + platform);
43554355 end for ;
4356- if 0 <> System . systemCall (Autoconf . make + " -f " + filenameprefix + "_FMU.makefile clean" , outFile= logfile) then
4356+ if 0 <> System . systemCallRestrictedEnv (Autoconf . make + " -f " + filenameprefix + "_FMU.makefile clean" , outFile= logfile) then
43574357 // do nothing
43584358 end if ;
43594359 return ;
0 commit comments