mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-11-29 02:00:26 +08:00
Small improvements to DaemonPrompter (#898)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user