Skip to content

Commit

Permalink
Get the cpu type on apple
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Jul 10, 2023
1 parent 57d5423 commit ef9757f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/pro/javacard/nfc4pc/CLIOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ef9757f

Please sign in to comment.