Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
I am opening a ChannelShell and executing a command "show" in the terminal as below.
so if you notice the (Root)show is also getting captured along with (Root) at last.when i run the same manually the actual output of "show" command is the Expected output as shown below.
what i am getting as output:
(Root) show
+-- Containers
+-- device-manager
+-- modules-state
+-- netconf
+-- netconf-state
+-- platform
+-- restconf-state
+-- schema-mounts
+-- xpon-tc-allocation
(Root)
Expected output:
+-- Containers
+-- device-manager
+-- modules-state
+-- netconf
+-- netconf-state
+-- platform
+-- restconf-state
+-- schema-mounts
+-- xpon-tc-allocation
code:
client = SshClient.setUpDefaultClient();
client.start();
session = client.connect(serverUsername, serverIp, Integer.parseInt(serverPort)).verify().getSession();
session.addPasswordIdentity(serverPassword);
session.auth().verify(TimeUnit.SECONDS.toMillis(50L)).isSuccess();
channel = session.createShellChannel();
PipedOutputStream pipedIn = new PipedOutputStream();
InputStream inPipe = new PipedInputStream(pipedIn);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
channel.setIn(inPipe);
channel.setOut(out);
channel.setErr(err);
channel.open();
pipedIn.write(("show" + "\n").getBytes(StandardCharsets.UTF_8));
pipedIn.flush();
channel.waitFor(EnumSet.of(ClientChannelEvent.EXIT_SIGNAL), 2 * 1000L);
List<String> output = Arrays.asList(new String(out.toByteArray()).split("\r\n"));
please let me know if i need set the PytMode or any configuration from client , that i may be missing.
I am using sshd-core 2.4.0