Closed llvilanova closed 6 years ago
This potentially causes an additional wait of up to 0.1 seconds, which I'd prefer to avoid by default.
It's only on older python versions, and a fairly small wait time. I can decrease it at the expense of processor time spent on busy-waiting.
Alternatively, is there any way to wait with a timeout on the child process? That would solve it without the extra wait.
Closing, see comment in #61.
If we wait for an SSH process in Python 2, there is no way to cancel the script unless we send SIGKILL to it (e.g., SIGINT won't work).
The following example will never raise KeyboardInterrupt in Python 2 until the process finishes:
import spur s = spur.SshShell(hostname="localhost", missing_host_key=spur.ssh.MissingHostKey.accept) s.run(["bash", "-c", "sleep 100000"])
We instead add an active wait loop (only in Python 2) so that it can catch up with queued signals.