diff --git a/src/main/java/com/openshift/internal/restclient/capability/resources/OpenShiftBinaryPortForwarding.java b/src/main/java/com/openshift/internal/restclient/capability/resources/OpenShiftBinaryPortForwarding.java index 2b9780f2..d08a18c7 100644 --- a/src/main/java/com/openshift/internal/restclient/capability/resources/OpenShiftBinaryPortForwarding.java +++ b/src/main/java/com/openshift/internal/restclient/capability/resources/OpenShiftBinaryPortForwarding.java @@ -103,9 +103,15 @@ private void startProcess(String location, PortPair [] ports) { } private void checkProcessIsAlive() throws IOException { - Thread.yield(); - if(!process.isAlive() && process.exitValue() != 0) { - throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream())); + try { + Thread.sleep(1000); + if(!process.isAlive() && process.exitValue() != 0) { + throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream())); + } + } catch (InterruptedException e) { + if(!process.isAlive() && process.exitValue() != 0) { + throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream())); + } } }