-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Description
Consider this small example:
#!/usr/bin/env python3
import asyncio
import asyncssh
hostname = 'example.org'
user = 'juser'
async def f():
async with asyncssh.connect(hostname, username=user) as c:
async with c.create_process('sleep 300') as p:
print('sleep')
await asyncio.sleep(3)
print('terminate')
p.terminate()
print('wait')
await p.wait()
print('done')
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(f())
loop.close()
Expected output:
sleep
terminate
wait
done
(program terminates - total runtime: 3 seconds or so)
Actual output:
sleep
terminate
wait
(program is still running)
That means it seems that the TERM signal isn't delivered.
(When I log into the remote system I see the process still running in pstree output - also after I kill the test program I see the orphaned sleep process via pgrep -u juser -P 1 -l -f)
I tested this against an sshd on a remote CentOS 7, an sshd on a remote Solaris 10 and a local sshd on Fedora 25 (localhost). Same results each time.
I also switched the 'sleep' command with '/usr/bin/sleep', and the p.terminate() call with p.kill() and p.send_break(1000). Doesn't make a difference.
Please advise if I'm using the asyncssh in a wrong way or if I'm missing something obvious.
Metadata
Metadata
Assignees
Labels
No labels