Skip to content

Commit a17c829

Browse files
Update src/main/java/simpaths/experiment/SimPathsStart.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c4c4644 commit a17c829

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main/java/simpaths/experiment/SimPathsStart.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,18 @@ public static void main(String[] args) {
108108

109109
if (!showGui) {
110110
engine.startSimulation();
111-
while (engine.getRunningStatus()) try {
112-
TimeUnit.SECONDS.sleep(10);
113-
} catch (InterruptedException e) {
114-
System.err.println("Interrupted while waiting for simulation to complete.");
115-
return;
111+
try {
112+
while (engine.getRunningStatus()) {
113+
try {
114+
TimeUnit.SECONDS.sleep(10);
115+
} catch (InterruptedException e) {
116+
System.err.println("Interrupted while waiting for simulation to complete.");
117+
return;
118+
}
119+
}
120+
} finally {
121+
engine.quit();
116122
}
117-
engine.quit();
118123
}
119124
}
120125

0 commit comments

Comments
 (0)