-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
Description
Hello an thanks for that library
Is it possible in ssh2-python
to the current process running in a channel, like it is in the ssh specs ?
for instance on paramiko you basically can't but you can always hack it with the private API:
from paramiko import Message
from paramiko.common import cMSG_CHANNEL_REQUEST
from signal import Signals
# trigger termination with a standard openssh packet (since v7.6) but using the private API of paramiko because it doesn't natively implements it
# spec: https://www.ietf.org/rfc/rfc4254.txt
message = Message()
message.add_byte(cMSG_CHANNEL_REQUEST)
message.add_int(channel.remote_chanid)
message.add_string("signal")
message.add_boolean(False)
message.add_string(Signals.SIGTERM.name[3:])
client.get_transport()._send_user_message(message)
It would greatly help me since i'm using SIGTERM and SIGINT signals to stop the continuously running processes i'm starting over ssh