This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
new 7fa2220 [KARAF-5296] Use Karaf shell:watch command and fix input
7fa2220 is described below
commit 7fa22207e5c2e82e508312049da8fc0e6f70e331
Author: Jean-Baptiste Onofré <[email protected]>
AuthorDate: Thu Dec 14 09:16:10 2017 +0100
[KARAF-5296] Use Karaf shell:watch command and fix input
---
.../java/org/apache/karaf/shell/commands/impl/WatchAction.java | 10 +++++-----
.../apache/karaf/shell/impl/console/SessionFactoryImpl.java | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git
a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
index 7f46282..31b2ea0 100644
---
a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
+++
b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
@@ -18,9 +18,7 @@
*/
package org.apache.karaf.shell.commands.impl;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
+import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
@@ -104,7 +102,8 @@ public class WatchAction implements Action {
try {
byteArrayOutputStream = new ByteArrayOutputStream();
printStream = new PrintStream(byteArrayOutputStream);
- session = sessionFactory.create(null, printStream,
printStream, WatchAction.this.session);
+ InputStream is = new ByteArrayInputStream(new byte[0]);
+ session = sessionFactory.create(is, printStream, printStream,
WatchAction.this.session);
String output = "";
try {
session.execute(command);
@@ -123,13 +122,14 @@ public class WatchAction implements Action {
byteArrayOutputStream.close();
session.close();
} catch (Exception e) {
- //Ingore
+ // ignore
}
}
public void abort() {
doDisplay = false;
}
+
public void close() throws IOException {
if (this.session != null) {
this.session.close();
diff --git
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/SessionFactoryImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/SessionFactoryImpl.java
index e6c5a20..d351753 100644
---
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/SessionFactoryImpl.java
+++
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/SessionFactoryImpl.java
@@ -72,7 +72,7 @@ public class SessionFactoryImpl extends RegistryImpl
implements SessionFactory,
}
Posix posix = new Posix(commandProcessor);
- for (String name : new String[]{"cat", "echo", "grep", "sort",
"sleep", "cd", "pwd", "ls", "less", "watch", "nano", "head", "tail", "clear",
"wc", "date", "tmux", "ttop"}) {
+ for (String name : new String[]{"cat", "echo", "grep", "sort",
"sleep", "cd", "pwd", "ls", "less", "nano", "head", "tail", "clear", "wc",
"date", "tmux", "ttop"}) {
register(new ShellCommand(name, null, posix, name));
}
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].