mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-05 12:50:30 +09:00
channels: Implement better ssh_channel_get_exit_state() variant
This way we will get errors as return code else we don't know if the function failed (SSH_ERROR) or the exit_status is -1 which would correspond to SSH_ERROR. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -462,7 +462,11 @@ LIBSSH_API int ssh_channel_close(ssh_channel channel);
|
||||
} \
|
||||
} while (0)
|
||||
LIBSSH_API void ssh_channel_free(ssh_channel channel);
|
||||
LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
|
||||
LIBSSH_API int ssh_channel_get_exit_state(ssh_channel channel,
|
||||
uint32_t *pexit_code,
|
||||
char **pexit_signal,
|
||||
int *pcore_dumped);
|
||||
SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
|
||||
LIBSSH_API ssh_session ssh_channel_get_session(ssh_channel channel);
|
||||
LIBSSH_API int ssh_channel_is_closed(ssh_channel channel);
|
||||
LIBSSH_API int ssh_channel_is_eof(ssh_channel channel);
|
||||
|
||||
@@ -498,8 +498,22 @@ public:
|
||||
return_throwable;
|
||||
}
|
||||
|
||||
int getExitStatus(){
|
||||
return ssh_channel_get_exit_status(channel);
|
||||
/*
|
||||
* @deprecated Please use getExitState()
|
||||
*/
|
||||
int getExitStatus() {
|
||||
uint32_t exit_status = (uint32_t)-1;
|
||||
ssh_channel_get_exit_state(channel, &exit_status, NULL, NULL);
|
||||
return exit_status;
|
||||
}
|
||||
void_throwable getExitState(uint32_t & pexit_code,
|
||||
char **pexit_signal,
|
||||
int & pcore_dumped) {
|
||||
ssh_throw(ssh_channel_get_exit_state(channel,
|
||||
&pexit_code,
|
||||
pexit_signal,
|
||||
&pcore_dumped));
|
||||
return_throwable;
|
||||
}
|
||||
Session &getSession(){
|
||||
return *session;
|
||||
|
||||
Reference in New Issue
Block a user