Subject: | [PATCH] Exit signal support |
Hi,
Exit signal support has recently been added to libssh2 (in the git repo,
not in any release yet). Attached patch exposes this functionality in
Net::SSH2. It's my first XS code so the patch might need refinement...
Thanks,
Tommy
Subject: | netssh2_exit_signal.diff |
=== modified file 'net-ssh2/SSH2.xs'
--- net-ssh2/SSH2.xs 2010-11-11 17:18:06 +0000
+++ net-ssh2/SSH2.xs 2010-11-15 12:18:00 +0000
@@ -1174,11 +1174,20 @@
clear_error(ch->ss);
XSRETURN_IV(libssh2_channel_get_exit_status(ch->channel));
-void
+SV*
net_ch_exit_signal(SSH2_CHANNEL* ch)
CODE:
clear_error(ch->ss);
- XSRETURN_PV(libssh2_channel_get_exit_signal(ch->channel));
+ RETVAL = NULL;
+ char *exitsignal = NULL;
+ libssh2_channel_get_exit_signal(ch->channel, &exitsignal,
+ NULL, NULL, NULL, NULL, NULL);
+ if (exitsignal) {
+ RETVAL = newSVpv(exitsignal, 0);
+ libssh2_free(ch->ss->session, exitsignal);
+ }
+OUTPUT:
+ RETVAL
#if LIBSSH2_VERSION_MAJOR >= 1