Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Running commands not returning results

$
0
0
tirrellcotton wrote:
Some commands are still freezing on the errreader.ReadToEnd() . Also command response in inconsistent. I can run the exact same command twice, first time it works, second time no response.
       cat /etc/*-release

Can you ensure on the server the command exits?
e.g. ps auxwww | grep cat

Can you also ensure the Connection is still up if the ReadToEnd() is hanging?
Another issue is If I change the current directory it doesn't remember it between commands. Here is how I'm creating a connection:
RunCommand() uses the ssh command feature. Means each command is started in it's own new "shell".

client.RunCommand("pwd")
=> $HOME

client.RunCommand("cd /tmp")
client.RunCommand("pwd")
=> $HOME

client.RunCommand("cd /tmp && pwd")
=> /tmp

If you want the same environment for all command, you have to use a ShellStream.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>