Subject: Input command echo's back when read back from the channel

Input command echo's back when read back from the channel

From: Srikanth Bemineni <bemineni.srikanth_at_gmail.com>
Date: Fri, 17 Jul 2015 13:41:15 -0500

Hi,

We used libssh2 to execute a remote command to check if a process is
running or not. We created a vanilla pty. Once the channel is created,
using libssh2_channel_write() we input the command onto the channel. Once
the command is completed we try to read the output using
libssh2_channel_read() method. The output buffer received has input command
along with result of the command It also contain some un recognizable
characters Please find the example below.

Command: ps -efww | grep -i Sample* | grep -v grep | awk -F" "
'{for(i=8;i<=NF;i++) {printf $i " "} printf "\n"}'

Output buffer:

ps -efww | grep -i Sample* | grep -v grep | awk -F" " '{fof <-i Sample* |
grep -v grep | awk -F" " '{for (i=8;i<=NF;i++) {printf $ [ junk characters ]

<-v grep | awk -F" " '{for(i=8;i<=NF;i++) {printf $i " "} printf "\n"}'

/root/Desktop/SampleProc
$

Can I get some directions on how to remove this.? also can you please
enlighten me on the concept of the channels.

Thank you

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-07-17