Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements to DaemonPrompter #898

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading