diff --git a/bls/src/main/java/tech/pegasys/teku/bls/impl/blst/MacCpuInfo.java b/bls/src/main/java/tech/pegasys/teku/bls/impl/blst/MacCpuInfo.java index 9170e8d53ef..b6fbe662927 100644 --- a/bls/src/main/java/tech/pegasys/teku/bls/impl/blst/MacCpuInfo.java +++ b/bls/src/main/java/tech/pegasys/teku/bls/impl/blst/MacCpuInfo.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.nio.charset.Charset; +import java.util.concurrent.TimeUnit; import org.apache.commons.io.IOUtils; public class MacCpuInfo { @@ -29,6 +30,15 @@ private static boolean macHasCpuFeature(final String cpuFeature) throws IOExcept .redirectErrorStream(true) .start(); final String output = IOUtils.toString(process.getInputStream(), Charset.defaultCharset()); + + try { + if (!process.waitFor(5, TimeUnit.SECONDS)) { + throw new IllegalStateException("sysctl took too long to exit."); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new IllegalStateException("Interrupted while waiting for sysctl to exit", e); + } return process.exitValue() == 0 && output != null && output.trim().equals("1"); } }