Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: command args split #14

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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