Skip to content

Commit

Permalink
Small improvements to DaemonPrompter (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 25, 2023
1 parent 92dd3f5 commit acf64a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,12 @@ private boolean doAccept(Message entry) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private void doDisplay(String message) throws IOException {
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);
Expand All @@ -166,9 +166,9 @@ private String doPrompt(String message, boolean password) throws IOException {
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);
Expand Down

0 comments on commit acf64a7

Please sign in to comment.