c# - Specific runtime environment commands doesn't work in SSH.NET -
i'm using ssh.net connect (with username + password) server , run commands. connection server made manage components via cisco application control software, shouldn't matter because command sent are.
connection server works well, other commands work 2 specific commands doesn't work, , can't seem understand why.
commands fail are: changeto production
, terminal length 0
.
code pretty simple (simplified question, same flow):
using (var client = new sshclient(serverip, port, username, password) { client.connect(); var cmd = client.runcommand("terminal length 0"); cmd = client.runcommand("changeto production"); // other command follow }
while running same commands via putty works, , no, changeto
shouldn't change to
.
think problem here changing scopes (changeto production) via code, can't understand why.
any appreciated.
after searching , asking on codeplex forum of ssh.net library, understood problem: runcommand()
function creates new shell every call.
new shell created default environment, , because terminal length 0
, changeto production
change runtime-environment following commands, can't accomplished runcommand()
.
ended writing , reading directly shell stream (using sshclient.createshellstream()
) , playing expect()
, parse output need. way commands executed in same shell.
Comments
Post a Comment