diff --git a/gclc-process/src/main/java/net/bigeon/gclc/process/io/ConnectingConsoleInput.java b/gclc-process/src/main/java/net/bigeon/gclc/process/io/ConnectingConsoleInput.java index d6d8fc7..d91e7ca 100644 --- a/gclc-process/src/main/java/net/bigeon/gclc/process/io/ConnectingConsoleInput.java +++ b/gclc-process/src/main/java/net/bigeon/gclc/process/io/ConnectingConsoleInput.java @@ -206,10 +206,18 @@ public final class ConnectingConsoleInput implements ConsoleInput { return doPrompt(message, timeout, tic); } + /** Actually do the prompting + * + * @param message the prompt message + * @param timeout the time to wait for an answer + * @param tic the moment the wait started + * @return the message provided through the prompting + * @throws IOException if an IO error occurred while prompting. */ private String doPrompt(final String message, final long timeout, final long tic) throws IOException { do { if (!checkPrompt()) { + // We are not prompting... lets stop here. break; } getConnection(getTimeoutLeft(tic, timeout)); @@ -220,10 +228,13 @@ public final class ConnectingConsoleInput implements ConsoleInput { actualConnected = connected; } if (!connect) { + // There is no provide of input... So lets start again, until we actually + // DO get a provider of input. continue; } try { final String res = actualPrompt(message, timeout, tic, actualConnected); + // We got something from the prompting synchronized (promptLock) { if (prompting) { prompting = false;