Small improvements to DaemonPrompter (#898)

This commit is contained in:
Guillaume Nodet
2023-10-25 17:03:24 +02:00
committed by GitHub
parent 92dd3f5c81
commit acf64a7fab
2 changed files with 9 additions and 7 deletions

View File

@@ -346,10 +346,12 @@ public class TerminalOutput implements ClientOutput {
readInput.writeLock().lock();
try {
clearDisplay();
String msg = (maxThreads > 1)
? String.format("[%s] %s", prompt.getProjectId(), prompt.getMessage())
: prompt.getMessage();
terminal.writer().print(msg);
if (prompt.getMessage() != null) {
String msg = (maxThreads > 1)
? String.format("[%s] %s", prompt.getProjectId(), prompt.getMessage())
: prompt.getMessage();
terminal.writer().print(msg);
}
terminal.flush();
StringBuilder sb = new StringBuilder();
while (true) {

View File

@@ -153,7 +153,7 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
Connection con = Objects.requireNonNull(Connection.getCurrent());
String projectId = ProjectBuildLogAppender.getProjectId();
Message.ProjectEvent msg = Message.display(projectId, message);
LOGGER.info("Sending display request: {}", msg);
LOGGER.debug("Sending display request: {}", msg);
con.dispatch(msg);
} catch (Exception e) {
throw new IOException("Unable to display message", e);
@@ -166,9 +166,9 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
String projectId = ProjectBuildLogAppender.getProjectId();
String uid = UUID.randomUUID().toString();
Message.Prompt msg = new Message.Prompt(projectId, uid, message, password);
LOGGER.info("Requesting prompt: {}", msg);
LOGGER.debug("Requesting prompt: {}", msg);
Message.PromptResponse res = con.request(msg, Message.PromptResponse.class, r -> uid.equals(r.getUid()));
LOGGER.info("Received response: {}", res.getMessage());
LOGGER.debug("Received response: {}", res.getMessage());
return res.getMessage();
} catch (Exception e) {
throw new IOException("Unable to prompt user", e);