www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: weird libssh2_channel_get_exit_status behaviour

Re: weird libssh2_channel_get_exit_status behaviour

From: Peter Stuge <peter_at_stuge.se>
Date: Thu, 12 Jul 2012 18:44:38 +0200

aalok sood wrote:
> libssh2_channel_get_exit_status documentation says that it returns 0
> on error
> How do I distinguish between and an Error and a exit_status of 0

You can't. libssh2 would have to be extended in order to tell exit
status 0 from an error. Feel free to do this and propose a patch.

> I am not sure how I can handle the case where in the remote process
> running the command got killed?

This is a separate question, and the answer is that you can only do
this by making the remote process handle the signal it gets sent, and
exit with a special exit code, which signals that it was killed.

Note that you can not handle SIGKILL. I am unsure what happens for
that case, but I am also curious to know so please try it out and let
us know.

libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-07-12

the libssh2 team