Skip to content

Commit e4d58d9

Browse files
committed
Jansi fails to start on Mac arm, fixes #207
1 parent 4822bb1 commit e4d58d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/fusesource/jansi/AnsiConsole.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ public static int getTerminalWidth() {
213213

214214
static final int ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
215215

216+
static int STDOUT_FILENO = 1;
217+
218+
static int STDERR_FILENO = 2;
219+
216220

217221
static {
218222
if (getBoolean(JANSI_EAGER)) {
@@ -236,7 +240,9 @@ private static AnsiPrintStream ansiStream(boolean stdout) {
236240
final boolean isatty;
237241
boolean isAtty;
238242
boolean withException;
239-
final int fd = stdout ? CLibrary.STDOUT_FILENO : CLibrary.STDERR_FILENO;
243+
// Do not use the CLibrary.STDOUT_FILENO to avoid errors in case
244+
// the library can not be loaded on unsupported platforms
245+
final int fd = stdout ? STDOUT_FILENO : STDERR_FILENO;
240246
try {
241247
// If we can detect that stdout is not a tty.. then setup
242248
// to strip the ANSI sequences..

0 commit comments

Comments
 (0)