[ https://issues.apache.org/jira/browse/SSHD-1027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17149862#comment-17149862 ]
vikash edited comment on SSHD-1027 at 7/2/20, 5:05 AM: ------------------------------------------------------- Thanks!, it's not a simple task indeed it keeps on breaking depending on the output. Is there any PtyMode you recommend that i can set to avoid this? my term type is xterm-256color was (Author: vikashks): Thanks!, it's not a simple task indeed it keeps on breaking depending on the output. Is there any PtyMode you recommend that i can set to avoid this? > The terminal input is also getting captured along with output in channelShell > ----------------------------------------------------------------------------- > > Key: SSHD-1027 > URL: https://issues.apache.org/jira/browse/SSHD-1027 > Project: MINA SSHD > Issue Type: Bug > Reporter: vikash > Priority: Major > > 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 -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org