session.setEnvVar throws ConnectionError
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 620
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 11
Description
I'm testing to connect to localhost.
I manage to connect and execute a command without `session.setEnvVar`.
With `session.setEnvVar` enabled it throws:
```
net.schmizz.sshj.connection.ConnectionException: Request failed
at net.schmizz.sshj.connection.channel.AbstractChannel.gotResponse(AbstractChannel.java:401)
at net.schmizz.sshj.connection.channel.AbstractChannel.handle(AbstractChannel.java:204)
at net.schmizz.sshj.connection.ConnectionImpl.handle(ConnectionImpl.java:128)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:475)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195)
at net.schmizz.sshj.transport.Reader.run(Reader.java:72)
```
The code is as follows:
```
SSHClient ssh = new SSHClient();
ssh.addHostKeyVerifier(new PromiscuousVerifier());
ssh.connect("192.168.1.99"); //localhost
TaskRunResponse response;
try {
ssh.authPassword("user", "pwd");
Session session = ssh.startSession();
try {
session.setEnvVar("testenv", "123");
Session.Command cmd = session.exec("/Users/selimober/tmp/paramandenvtest.sh 10");
cmd.join();
String output = IOUtils.readFully(cmd.getInputStream()).toString();
Integer exitStatus = cmd.getExitStatus();
response = new TaskRunResponse(ExitStatus.SUCCESS, output);
} finally {
session.close();
}
} finally {
ssh.disconnect();
}
```
Version: net.schmizz:sshj:0.9.0
Server: SSH-2.0-OpenSSH_6.2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.