Skip to content
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 @@ -323,6 +323,13 @@ protected final void createTerminal(C context) {
context.terminal = MessageUtils.getTerminal();
context.closeables.add(MessageUtils::systemUninstall);
MessageUtils.registerShutdownHook(); // safety belt

// when we use embedded executor AND --raw-streams, we must ENSURE streams are properly set up
if (context.invokerRequest.embedded()
&& context.options().rawStreams().orElse(false)) {
// to trigger FastTerminal; with raw-streams we must do this ASAP (to have system in/out/err set up)
context.terminal.getName();
}
} else {
doConfigureWithTerminal(context, context.terminal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ private String validateOutput(boolean shave, ByteArrayOutputStream stdout, ByteA
result = result.replace("\n", "").replace("\r", "");
}
// sanity checks: stderr has any OR result is empty string (no method should emit empty string)
if (stderr.size() > 0 || result.trim().isEmpty()) {
System.err.println(
"Unexpected stdout[" + stdout.size() + "]=" + stdout + "; stderr[" + stderr.size() + "]=" + stderr);
if (result.trim().isEmpty()) {
// see bug https://github.com/apache/maven/pull/11303 Fail in this case
// tl;dr We NEVER expect empty string as output from this tool; so fail here instead to chase ghosts
throw new IllegalStateException("Empty output from Toolbox; stdout[" + stdout.size() + "]=" + stdout
+ "; stderr[" + stderr.size() + "]=" + stderr);
}
return result;
}
Expand Down
Loading