Skip to content

Commit

Permalink
fix: command args split (#14)
Browse files Browse the repository at this point in the history
For some reason, this worked before and doesn't now? 🤦
  • Loading branch information
metacosm committed Jan 17, 2024
1 parent 6d74e21 commit d1e0240
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ public class MacOSPowermetricsSensor implements PowerSensor {
public MacOSPowermetricsSensor() {
// extract metadata
try {
final var exec = new ProcessBuilder().command("sudo", "powermetrics", "--samplers cpu_power", "-i 10", "-n 1").start();
if (exec.waitFor(20, TimeUnit.MILLISECONDS)) {
this.cpu = initMetadata(exec.getInputStream());
} else {
throw new IllegalStateException("Couldn't execute powermetrics to extract metadata");
}
final var exec = new ProcessBuilder()
.command("sudo", "powermetrics", "--samplers", "cpu_power", "-i", "10", "-n", "1")
.start();
this.cpu = initMetadata(exec.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
throw new RuntimeException("Couldn't execute powermetrics to extract metadata", e);
}
}

Expand Down

0 comments on commit d1e0240

Please sign in to comment.