diff --git a/.gitignore b/.gitignore index 7443375..a212e8c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist/ lib/ out/ +*.iws diff --git a/agent/src/unityRunner/agent/UnityRunner.java b/agent/src/unityRunner/agent/UnityRunner.java index 9d93d8b..2599d1e 100644 --- a/agent/src/unityRunner/agent/UnityRunner.java +++ b/agent/src/unityRunner/agent/UnityRunner.java @@ -1,7 +1,6 @@ package unityRunner.agent; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.LineIterator; import org.apache.commons.io.input.Tailer; import org.jetbrains.annotations.NotNull; @@ -84,17 +83,16 @@ List getArgs() { * start the unity runner */ public void start() { -// -// logMessage("[Starting UnityRunner]"); -// -// Thread runnerThread = new Thread(new Runnable() { -// @Override -// public void run() { -// tailLogFile(); -// } -// }); -// runnerThread.start(); - logMessage("[Unity runner is started, but waiting until end to cat log file]"); + + logMessage("[Starting UnityRunner]"); + + Thread runnerThread = new Thread(new Runnable() { + @Override + public void run() { + tailLogFile(); + } + }); + runnerThread.start(); if (configuration.clearBefore) { clearBefore(); @@ -126,56 +124,6 @@ private void tailLogFile() { } - /** - * cat the log file instead of tailing it - */ - private void catLogFile() { - logMessage("[Catting log file]"); - if ( configuration.ignoreLogBefore) { - logMessage("[Ignoring lines before text "+configuration.ignoreLogBeforeText +"]"); - } - - File file = new File(configuration.getInterestedLogPath()); - - // for each line - try { - LineIterator iterator = FileUtils.lineIterator(file); - List ignoredLines = new ArrayList(); - boolean stillIgnoringLines = configuration.ignoreLogBefore; - try { - while (iterator.hasNext()) { - String line = iterator.nextLine(); - if (stillIgnoringLines && line.contentEquals(configuration.ignoreLogBeforeText)){ - stillIgnoringLines = false; - } - - if (line.length() > 0) { - if ( stillIgnoringLines ) { - // add the message to the ignored group - ignoredLines.add(line); - } else { - // log the message - logMessage(line); - } - } - } - if (stillIgnoringLines) { - // we have finished processing the log and we've ignored everything - logMessage("[The configured text has not been found: "+configuration.ignoreLogBeforeText +"]"); - // we better output all these lines - logMessages(ignoredLines); - } - } finally { - iterator.close(); - } - - } catch (IOException e) { - e.printStackTrace(); - } - - - } - private void logMessages(List lines) { for (String line : lines){ logMessage(line); @@ -186,9 +134,8 @@ private void logMessages(List lines) { * stop the runner */ public void stop() { - catLogFile(); -// stop = true; -// logMessage("[Stop UnityRunner]"); + stop = true; + logMessage("[Stop UnityRunner]"); }