From 0c32889ebcc61845765514fee56d6641bd91b542 Mon Sep 17 00:00:00 2001 From: Simeon Andreev Date: Fri, 17 Jun 2022 12:19:50 +0200 Subject: Run tests that checks araxis output only on Linux Bug: 580189 Change-Id: Ieb14f5cf061fcb468b602c7f27e27b672e3b09e2 Signed-off-by: Simeon Andreev --- .../src/org/eclipse/jgit/util/SystemReader.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'org.eclipse.jgit/src') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java index 16e2577911..5ced0713e0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -63,6 +63,8 @@ public abstract class SystemReader { private static volatile Boolean isWindows; + private static volatile Boolean isLinux; + static { SystemReader r = new Default(); r.init(); @@ -185,6 +187,7 @@ public abstract class SystemReader { public static void setInstance(SystemReader newReader) { isMacOS = null; isWindows = null; + isLinux = null; if (newReader == null) INSTANCE = DEFAULT; else { @@ -543,6 +546,20 @@ public abstract class SystemReader { return isMacOS.booleanValue(); } + /** + * Whether we are running on Linux. + * + * @return true if we are running on Linux. + * @since 6.3 + */ + public boolean isLinux() { + if (isLinux == null) { + String osname = getOsName(); + isLinux = Boolean.valueOf(osname.toLowerCase().startsWith("linux")); //$NON-NLS-1$ + } + return isLinux.booleanValue(); + } + private String getOsName() { return AccessController.doPrivileged( (PrivilegedAction) () -> getProperty("os.name") //$NON-NLS-1$ -- cgit v1.2.3