Skip to content

Commit

Permalink
mvnd --help produces no output #238
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Dec 7, 2020
1 parent 4ab67f2 commit d57e0fc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -19,10 +19,12 @@
package org.apache.maven.cli;

import com.google.inject.AbstractModule;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
@@ -267,7 +269,11 @@ void cli(CliRequest cliRequest)
}

if (cliRequest.commandLine.hasOption(CLIManager.HELP)) {
cliManager.displayHelp(System.out);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintStream out = new PrintStream(baos, false, StandardCharsets.UTF_8.name())) {
cliManager.displayHelp(out);
}
AbstractLoggingSpy.instance().append(null, new String(baos.toByteArray(), StandardCharsets.UTF_8));
throw new ExitException(0);
}

0 comments on commit d57e0fc

Please sign in to comment.