Activate TerminalOutput.noBuffering when -B/--batch-mode is passed via CLI

This commit is contained in:
Peter Palaga
2020-11-12 10:00:03 +01:00
parent a0e94a2e6c
commit 4afe9057a2
2 changed files with 7 additions and 3 deletions

View File

@@ -49,6 +49,7 @@ public class DefaultClient implements Client {
Path logFile = null;
int i = 0;
boolean batchMode = false;
while (i < argv.length) {
final String arg = argv[i++];
if ("-l".equals(arg) || "--log-file".equals(arg)) {
@@ -58,12 +59,15 @@ public class DefaultClient implements Client {
throw new IllegalArgumentException("-l and --log-file need to be followed by a path");
}
} else {
if (!batchMode && ("-B".equals(arg) || "--batch-mode".equals(arg))) {
batchMode = true;
}
args.add(arg);
}
}
DaemonParameters parameters = new DaemonParameters();
try (TerminalOutput output = new TerminalOutput(parameters.noBuffering(), parameters.rollingWindowSize(), logFile)) {
try (TerminalOutput output = new TerminalOutput(batchMode || parameters.noBuffering(), parameters.rollingWindowSize(), logFile)) {
try {
new DefaultClient(parameters).execute(output, args);
} catch (DaemonException.InterruptedException e) {

View File

@@ -61,7 +61,7 @@ public enum Environment {
MVND_DAEMON_STORAGE("mvnd.daemon.storage", null, null, false),
/**
* Property that can be set to avoid buffering the output and display events continuously, closer to the usual maven
* display.
* display. Passing {@code -B} or {@code --batch-mode} on the command line enables this too for the given build.
*/
MVND_NO_BUFERING("mvnd.noBuffering", null, "false", false),
/**
@@ -101,7 +101,7 @@ public enum Environment {
},
/**
* The maven builder name to use. Ignored if the user passes
*
*
* @{@code -b} or @{@code --builder} on the command line
*/
MVND_BUILDER("mvnd.builder", null, "smart", false) {