Thanks! So looks like the issue is still unresolved.

I think this is very critical.

So I have made some progress, but now everything is written to the same line, 
no matter what.

I’m using the following PTY options:

PtyMode.ONLCR
PtyMode.OCRNL
PtyMode.ONOCR
PtyMode.ECHO
PtyMode.INLCR
PtyMode.ICRNL

And using the following constructors:

    CmdLineServiceHandler(CLIShellFactory.CLIShell shell) throws IOException {
      super("Command line server handler");
      //PtyMode.ONLCR, PtyMode.OCRNL, PtyMode.ONLRET, PtyMode.ONOCR
      //PtyMode.ECHO, PtyMode.INLCR, PtyMode.ICRNL, PtyMode.IGNCR
      Set<PtyMode> mode_options = 
Collections.unmodifiableSet(EnumSet.of(PtyMode.ONLCR, PtyMode.OCRNL, 
PtyMode.ONOCR, PtyMode.ECHO, PtyMode.INLCR, PtyMode.ICRNL));
      TtyFilterInputStream echoStream = new 
TtyFilterInputStream(shell.getInputStream(), mode_options);
      input = new BufferedReader(new InputStreamReader(new 
TtyFilterInputStream(shell.getInputStream(), mode_options)));
      output = new PrintStream(new 
TtyFilterOutputStream(shell.getOutputStream(), echoStream, mode_options), true);
      //input = new BufferedReader(new 
InputStreamReader(shell.getInputStream()));
      //output = new PrintStream(shell.getOutputStream());

Any idea on correct PTY options? I tried InteractiveProcessShellFactory.java 
<https://github.com/apache/mina-sshd/blob/master/sshd-core/src/main/java/org/apache/sshd/server/shell/InteractiveProcessShellFactory.java>
 and it seems to work, but not with my Custom Shell and Command.

Thanks,
Oskar

> On Oct 27, 2020, at 12:53 PM, Lyor Goldstein <[email protected]> wrote:
> 
>>> I would really appreciate someone who has experience with this to give
> me some guidance. I have searched the web and cannot seem to find anything.
> 
>>> Hope someone can help…
> 
> This is an oldie but goodie - we have made several attempts in the past
> (see SSHD-897 SSHD-1029) but we always come up short since there seem to be
> many behavior variations on the sent escape sequence and echo options...

Reply via email to