hierynomus / hierynomus/sshj

A bug in example of RudimentaryPTY

Open
#273 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

Hi,

first of all, many thanks for this awesome library. It's so much better and easier to understand than JSch!

Because there's not much of documentation available yet, I started off with examples - RudimentaryPTY being almost exactly what I needed. However, what caused me some head scratching and several wasted hours was to get hold of how it all works and why it didn't work for me.

The thing is that when a new thread is created for copying error/standard output from remote system to the local one using

`new StreamCopier(shell.getInputStream(), System.out)
.bufSize(shell.getLocalMaxPacketSize())
.spawn("stdout");`

than as the example source is written, all depends on thread timing. What is missing from the example is that we need to wait for all the output/errors to be copied using

Event outEvent = `new StreamCopier(shell.getInputStream(), System.out)
.bufSize(shell.getLocalMaxPacketSize())
.spawn("stdout");
...
outEvent.await();`

One more thing which would be helpful is to provide sample of suppressing echo during communication. So, instead of

`session.allocateDefaultPTY();`

something like

```
Map ptyModeMap = new HashMap<>();
// disables echoing of input to output (default behaviour)
ptyModeMap.put(PTYMode.ECHO, 0);

session.allocatePTY("vt100", 120, 120, 0, 0, ptyModeMap);
```

could appear

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.