исправил баг с запуском процессов. иногда файл скриптов запускался не сразу из за запоздалого закрытия fileutils.write

This commit is contained in:
2023-10-23 01:32:28 +03:00
parent 19370c60d9
commit 82df491e29
5 changed files with 41 additions and 15 deletions

View File

@@ -100,15 +100,27 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
if (!file.setExecutable(true))
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
//--
ProcessBuilder procBuilder = new ProcessBuilder(file.getAbsolutePath());
procBuilder.directory(workspace);
process = procBuilder.start();
exit_code = process.waitFor();
boolean flag = false;
do {
try {
ProcessBuilder procBuilder = new ProcessBuilder(file.getAbsolutePath());
procBuilder.directory(workspace);
process = procBuilder.start();
exit_code = process.waitFor();
flag = true;
} catch (Exception ex) {
Global.Log.PrintException(ex);
Utils.sleep(1000);
}
}
while (!flag);
process = null;
//---
outputLines = new Vector<>(FileUtils.readLines(outputFile));
errorsLines = new Vector<>(FileUtils.readLines(errorsFile));
return (exit_code == 0) && checkLines(outputLines) && checkLines(errorsLines);
return (exit_code == 0) &&
checkLines(outputLines) &&
checkLines(errorsLines);
}
protected boolean parse() throws Exception {
if (performSapforScript("parse", parentTask,