Skip to content

Commit

Permalink
Deal with UnsatisfiedLinkError: when native lib can't be loaded, jans…
Browse files Browse the repository at this point in the history
…i can deal with this case.
  • Loading branch information
jbonofre committed Sep 28, 2016
1 parent fad337e commit 074c23b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,27 @@ public class AnsiConsole {
public static final PrintStream out = new PrintStream( wrapOutputStream( system_out ) );

public static final PrintStream system_err = System.err;
public static final PrintStream err = new PrintStream( wrapOutputStream( system_err, STDERR_FILENO ) );
public static final PrintStream err = new PrintStream( wrapErrorOutputStream( system_err ) );

private static int installed;

private AnsiConsole() {
}

public static OutputStream wrapOutputStream(final OutputStream stream) {
return wrapOutputStream(stream, STDOUT_FILENO);
try {
return wrapOutputStream(stream, STDOUT_FILENO);
} catch (Throwable ignore) {
return wrapOutputStream(stream, 0);
}
}

public static OutputStream wrapErrorOutputStream(final OutputStream stream) {
try {
return wrapOutputStream(stream, STDERR_FILENO);
} catch (Throwable ignore) {
return wrapOutputStream(stream, 0);
}
}

public static OutputStream wrapOutputStream(final OutputStream stream, int fileno) {
Expand Down

0 comments on commit 074c23b

Please sign in to comment.