Skip to content

Commit

Permalink
Merge branch 'main' into syntax-role-modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Nov 29, 2023
2 parents 5ed339c + e17f90a commit 4cd9e61
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/org/rascalmpl/library/Prelude.java
Original file line number Diff line number Diff line change
Expand Up @@ -923,15 +923,15 @@ public void iprint(IValue arg, IInteger lineLimit){
// ignore, it's what we wanted
}
catch (IOException e) {
RuntimeExceptionFactory.io(values.string("Could not print indented value"));
throw RuntimeExceptionFactory.io(values.string("Could not print indented value"));
}
finally {
try {
output.flush();
output.close();
}
catch (IOException e) {
}
try {
output.flush();
}
catch (IOException e) {
// ignore
}
}
}

Expand Down
24 changes: 13 additions & 11 deletions src/org/rascalmpl/repl/BaseREPL.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,19 +363,21 @@ public void run() throws IOException {
// we are closing down, so do nothing, the finally clause will take care of it
}
catch (Throwable e) {
try (PrintWriter err = new PrintWriter(errorWriter, true)) {
PrintWriter err = new PrintWriter(errorWriter, true);

if (!err.checkError()) {
err.println("Unexpected (uncaught) exception, closing the REPL: ");
if (!err.checkError()) {
err.print(e.toString());
e.printStackTrace(err);
}
else {
System.err.print(e.toString());
e.printStackTrace();
}
err.flush();
err.print(e.toString());
e.printStackTrace(err);
}
errorWriter.flush();
else {
System.err.println("Unexpected (uncaught) exception, closing the REPL: ");
System.err.print(e.toString());
e.printStackTrace(System.err);
}

err.flush();

throw e;
}
finally {
Expand Down

0 comments on commit 4cd9e61

Please sign in to comment.