diff --git a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java index 6bcc5fde33..1331f1b8c3 100644 --- a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java +++ b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java @@ -178,26 +178,21 @@ public void doGenerate(List federates, RtiConfig rtiConfig) { .append("\n"); } } - if (host.equals("localhost") || host.equals("0.0.0.0")) { - // Local PID managements - shCode.append( - "echo \"#### Bringing the RTI back to foreground so it can receive Control-C.\"" + "\n"); - shCode.append("fg %1" + "\n"); - } // Wait for launched processes to finish shCode .append( String.join( "\n", - "echo \"RTI has exited. Wait for federates to exit.\"", - "# Wait for launched processes to finish.", - "# The errors are handled separately via trap.", + "EXITED_SUCCESSFULLY=true", + "wait $RTI || EXITED_SUCCESSFULLY=false", "for pid in \"${pids[@]}\"", "do", - " wait $pid || exit $?", + " wait $pid", + " if [ $? -ne 0 -a $? -ne 127 ]; then", + " EXITED_SUCCESSFULLY=false", + " fi", "done", - "echo \"All done.\"", - "EXITED_SUCCESSFULLY=true")) + "echo \"All done.\"")) .append("\n"); // Create bin directory for the script.