You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2017/09/01 08:53:16 UTC
karaf git commit: [KARAF-5320] Karaf Command Arguments escapes
backslash characters
Repository: karaf
Updated Branches:
refs/heads/master cf6671014 -> 7f6a3859d
[KARAF-5320] Karaf Command Arguments escapes backslash characters
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/7f6a3859
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/7f6a3859
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/7f6a3859
Branch: refs/heads/master
Commit: 7f6a3859d7beff00a87a089388779476d91b0724
Parents: cf66710
Author: Guillaume Nodet <gn...@apache.org>
Authored: Fri Sep 1 10:53:10 2017 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Fri Sep 1 10:53:10 2017 +0200
----------------------------------------------------------------------
.../shell/impl/console/ConsoleSessionImpl.java | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/7f6a3859/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
----------------------------------------------------------------------
diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index 0f30c3f..7e3d5fe 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.felix.gogo.jline.ParsedLineImpl;
import org.apache.felix.gogo.jline.Shell;
import org.apache.felix.gogo.runtime.CommandSessionImpl;
import org.apache.felix.service.command.CommandProcessor;
@@ -346,11 +347,11 @@ public class ConsoleSessionImpl implements Session {
String scriptFileName = System.getProperty(SHELL_INIT_SCRIPT);
executeScript(scriptFileName);
while (running) {
- String command = readCommand(reading);
+ CharSequence command = readCommand(reading);
if (command == null) {
break;
}
- execute(command);
+ doExecute(command);
}
close();
} finally {
@@ -383,11 +384,17 @@ public class ConsoleSessionImpl implements Session {
return isLocal != null && isLocal;
}
- private String readCommand(AtomicBoolean reading) throws UserInterruptException {
- String command = null;
+ private CharSequence readCommand(AtomicBoolean reading) throws UserInterruptException {
+ CharSequence command = null;
reading.set(true);
try {
- command = reader.readLine(getPrompt(), getRPrompt(), null, null);
+ reader.readLine(getPrompt(), getRPrompt(), null, null);
+ ParsedLine pl = reader.getParsedLine();
+ if (pl instanceof ParsedLineImpl) {
+ command = ((ParsedLineImpl) pl).program();
+ } else {
+ command = pl.line();
+ }
} catch (EndOfFileException e) {
command = null;
} catch (UserInterruptException e) {
@@ -400,7 +407,7 @@ public class ConsoleSessionImpl implements Session {
return command;
}
- private void execute(String command) {
+ private void doExecute(CharSequence command) {
try {
Object result = session.execute(command);
if (result != null) {