[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get exit code of a executed remote command


Hi Oliver,

that seems to work, thanks a lot for your help!
By the way I figured out that ssh_channel_send_eof() instead of ssh_channel_close() also works.


Regards,

Thomas

The function is quite flakey, because of issue in the way the close
flag is handled internally. I had to do two things:

1. call ssh_channel_close() before you call
ssh_channel_get_exit_status()
2. put ssh_channel_get_exit_status() in a loop and wait for the
result to be not -1. I am waiting 20 times 50ms.

This have been very reliable in using it with dozens, maybe even
hundreds or thousands of machines in the past few months.

As a side note, you might also run into this problem with buggy SSH
daemons. There was apparently a dropbear version, that didn't always
send the exit status.

Hi,

I tried to run a command on a remote host via "ssh_channel_request_exec"
and get the the exit code back. My problem is that
"ssh_channel_get_exit_status" returns always -1.

Any idea what I'm doing wrong?


Thanks in advance,

Thomas






Follow-Ups:
Re: Get exit code of a executed remote command"Oliver Stöneberg" <oliverst@xxxxxxxxx>
References:
Get exit code of a executed remote commandThomas Mayer <tm.telemotive@xxxxxx>
Re: Get exit code of a executed remote command"Oliver Stöneberg" <oliverst@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org