Skip to content

Commit

Permalink
Merge pull request payara#5297 from OndroMih/FISH-1423-disable-escapi…
Browse files Browse the repository at this point in the history
…ng-asadmin

Copy code from my fork to a branch
  • Loading branch information
Ondro Mihályi authored and JamesHillyard committed Dec 23, 2021
1 parent c4398b2 commit d10c893
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1440,12 +1440,19 @@ protected void buildTerminal() {

protected void buildLineReader() {
if (lineReader == null) {
lineReader = LineReaderBuilder.builder()
lineReader = newLineReaderBuilder()
.terminal(terminal)
.build();
}
}

protected LineReaderBuilder newLineReaderBuilder() {
return LineReaderBuilder.builder()
.appName(ASADMIN)
// disable event expansion because it swallows backslashes and we don't need to support events
.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true);
}

protected void closeTerminal() {
try {
if (terminal != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.jline.reader.Completer;
import org.jline.reader.EndOfFileException;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.reader.UserInterruptException;
import org.jline.reader.impl.completer.StringsCompleter;
import org.jline.terminal.Terminal;
Expand Down Expand Up @@ -149,8 +148,7 @@ protected int executeCommand() throws CommandException, CommandValidationExcepti
.encoding(encoding != null ? Charset.forName(encoding) : Charset.defaultCharset())
.build();

reader = LineReaderBuilder.builder()
.appName(ASADMIN)
reader = newLineReaderBuilder()
.terminal(asadminTerminal)
.completer(completer)
.build();
Expand Down Expand Up @@ -183,9 +181,8 @@ public void write(byte[] b, int off, int len) throws IOException {
Terminal asadminTerminal = new ExternalTerminal(ASADMIN, "",
new FileInputStream(file), out, encoding != null ? Charset.forName(encoding) : Charset.defaultCharset());

reader = LineReaderBuilder.builder()
reader = newLineReaderBuilder()
.terminal(asadminTerminal)
.appName(ASADMIN)
.build();
}

Expand Down

0 comments on commit d10c893

Please sign in to comment.