fixed the shell equinox shell command
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@888362 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java b/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
index d7e1c73..da1ebbc 100644
--- a/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
+++ b/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
@@ -13,7 +13,7 @@
}
public void _dm(CommandInterpreter ci) {
- StringBuffer line = new StringBuffer("");
+ StringBuffer line = new StringBuffer("dm ");
String arg = ci.nextArgument();
while (arg != null) {
if (line.length() > 0) {
@@ -24,8 +24,16 @@
}
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
ByteArrayOutputStream errorBytes = new ByteArrayOutputStream();
- super.execute(line.toString(), new PrintStream(bytes), new PrintStream(errorBytes));
- ci.print(new String(bytes.toByteArray()));
+ PrintStream out = new PrintStream(bytes);
+ PrintStream err = new PrintStream(errorBytes);
+ super.execute(line.toString(), out, err);
+ if (bytes.size() > 0) {
+ ci.print(new String(bytes.toByteArray()));
+ }
+ if (errorBytes.size() > 0) {
+ ci.print("Error:\n");
+ ci.print(new String(errorBytes.toByteArray()));
+ }
}
public String getHelp() {