From 77283f8c7d27ba54433d0f1c32c217df7c8389d9 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 24 Oct 2023 06:49:37 +0200 Subject: [PATCH] AIX issue with non english locales (#881) Backport of https://bugs.openjdk.java.net/browse/JDK-8261920 --- terminal/src/main/java/org/jline/utils/ExecHelper.java | 7 +++++++ terminal/src/main/java/org/jline/utils/OSUtils.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/terminal/src/main/java/org/jline/utils/ExecHelper.java b/terminal/src/main/java/org/jline/utils/ExecHelper.java index 4098cf5c1..1ef496526 100644 --- a/terminal/src/main/java/org/jline/utils/ExecHelper.java +++ b/terminal/src/main/java/org/jline/utils/ExecHelper.java @@ -14,6 +14,7 @@ import java.io.InputStream; import java.io.InterruptedIOException; import java.io.OutputStream; +import java.util.Map; import java.util.Objects; /** @@ -28,6 +29,12 @@ public static String exec(boolean redirectInput, final String... cmd) throws IOE try { Log.trace("Running: ", cmd); ProcessBuilder pb = new ProcessBuilder(cmd); + if (OSUtils.IS_AIX) { + Map env = pb.environment(); + env.put("PATH", "/opt/freeware/bin:" + env.get("PATH")); + env.put("LANG", "C"); + env.put("LC_ALL", "C"); + } if (redirectInput) { pb.redirectInput(ProcessBuilder.Redirect.INHERIT); } diff --git a/terminal/src/main/java/org/jline/utils/OSUtils.java b/terminal/src/main/java/org/jline/utils/OSUtils.java index 3c061b378..d1f3ae436 100644 --- a/terminal/src/main/java/org/jline/utils/OSUtils.java +++ b/terminal/src/main/java/org/jline/utils/OSUtils.java @@ -39,6 +39,8 @@ public class OSUtils { public static final boolean IS_OSX = System.getProperty("os.name").toLowerCase().contains("mac"); + public static final boolean IS_AIX = System.getProperty("os.name").equals("AIX"); + public static String TTY_COMMAND; public static String STTY_COMMAND; public static String STTY_F_OPTION;