scrapli / scrapligo

scrapli, but in go!
MIT License
258 stars 42 forks source link

Make sure we reap SSH process on Close() #177

Closed netixx closed 7 months ago

netixx commented 7 months ago

System transport can get stuck on the Read call because of pty implementation details (see https://github.com/scrapli/scrapligo/issues/174) for more details.

This makes sure that we kill the SSH process when the transport is closed, and in turn makes sure that the rest of the components (channel, drivers) can shutdown properly.

I also added a test simulating a blocking (stuck) SSH server and a non blokcing SSH server (non blocking showed that it's fine to kill an already defunct process).

carlmontanari commented 7 months ago

@netixx sorry for the big changes -- let me know if you are good with this.

I did what you did, just with std library since (for now?) we want to keep that crypto pin for 1.16 happiness.

annnnd I just saw it failed in ci (worked on my machine!) so will investigate that.

carlmontanari commented 7 months ago

I think im going to merge this and then the other branch to main so that I can get tmate setup working so I can troubleshoot the system transport in ci issue. python version of this works w/ the TERM env set so not sure what's up here. @netixx comment back here or ill catch ya in discord if you wanna see any changes/tweaks to this!

carlmontanari commented 7 months ago

ok, test fixed/ci passing now :)