hierynomus / hierynomus/sshj

While execution a command - not clear what's going on

Open
#575 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

I want to connect by ssh to remote host and execute a script, execution of script could take some time.

I am using following command:
```
String response = "";
String command = "./script.sh";
try (Session session = sshClient.startSession()) {
final Session.Command cmd = session.exec(command);
response = (IOUtils.readFully(cmd.getInputStream()).toString());
}
logger.info(response);
```

So, I would be able to get a response only, when a command is fully executed.
As a result, while execution a script, I don't know, what's going on.

Questions:
1) Is it possible to print in STDOUT - what is going while executing a script ?
2) Is it possible to print in STDOUT - errors while executing a script? Because after executing wrong command, for example "jjjj" I am not able to see any errors like "command not found: jjj" ?

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.