You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "vikash (Jira)" <ji...@apache.org> on 2020/07/01 14:21:00 UTC
[jira] [Updated] (SSHD-1027) The terminal input is also getting
captured along with output in channelShell
[ https://issues.apache.org/jira/browse/SSHD-1027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
vikash updated SSHD-1027:
-------------------------
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.
was:
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.
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org