From ef9757f205c20e9758fde99d9daf85ba16051591 Mon Sep 17 00:00:00 2001 From: Martin Paljak Date: Mon, 10 Jul 2023 11:58:16 +0300 Subject: [PATCH] Get the cpu type on apple --- src/main/java/pro/javacard/nfc4pc/CLIOptions.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/pro/javacard/nfc4pc/CLIOptions.java b/src/main/java/pro/javacard/nfc4pc/CLIOptions.java index bbc69cb..e59a037 100644 --- a/src/main/java/pro/javacard/nfc4pc/CLIOptions.java +++ b/src/main/java/pro/javacard/nfc4pc/CLIOptions.java @@ -61,8 +61,15 @@ protected static OptionSet parseArguments(String[] argv) throws IOException { } if (args.has(OPT_VERSION)) { - if (args.has(OPT_DEBUG)) - System.out.printf("# Running Java %s (%s) from %s on %s %s%n", System.getProperty("java.version"), System.getProperty("os.arch"), System.getProperty("java.vendor"), System.getProperty("os.name"), System.getProperty("os.version")); + if (args.has(OPT_DEBUG)) { + if (System.getProperty("os.name").equalsIgnoreCase("Mac OS X")) { + ProcessBuilder pb = new ProcessBuilder(List.of("/usr/sbin/sysctl", "-n", "machdep.cpu.brand_string")); + Process process = pb.start(); + String result = new String(process.getInputStream().readAllBytes()).trim(); + System.out.printf("# Running Java %s (%s) from %s on %s %s (%s)%n", System.getProperty("java.version"), System.getProperty("os.arch"), System.getProperty("java.vendor"), System.getProperty("os.name"), System.getProperty("os.version"), result); + } else + System.out.printf("# Running Java %s (%s) from %s on %s %s%n", System.getProperty("java.version"), System.getProperty("os.arch"), System.getProperty("java.vendor"), System.getProperty("os.name"), System.getProperty("os.version")); + } System.out.println("NFC4PC version " + CLIOptions.class.getPackage().getImplementationVersion()); System.exit(0); }