diff options
author | Michael Williamson <mike@zwobble.org> | 2013-09-29 17:50:22 +0100 |
---|---|---|
committer | Michael Williamson <mike@zwobble.org> | 2014-09-07 18:35:52 +0100 |
commit | b14aedee595ba673d58e04014ff6be65963740da (patch) | |
tree | 40a37c6a639c558acc2cec9ae13c51873e4692b2 | |
parent | e92b82eb8a2a08259f21eb711e8943382e0020f1 (diff) |
Turn ProxyCommand into a context manager
-rw-r--r-- | paramiko/proxy.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/paramiko/proxy.py b/paramiko/proxy.py index 8959b244..0664ac6e 100644 --- a/paramiko/proxy.py +++ b/paramiko/proxy.py @@ -26,9 +26,10 @@ from select import select import socket from paramiko.ssh_exception import ProxyCommandFailure +from paramiko.util import ClosingContextManager -class ProxyCommand(object): +class ProxyCommand(ClosingContextManager): """ Wraps a subprocess running ProxyCommand-driven programs. @@ -36,6 +37,8 @@ class ProxyCommand(object): `.Transport` and `.Packetizer` classes. Using this class instead of a regular socket makes it possible to talk with a Popen'd command that will proxy traffic between the client and a server hosted in another machine. + + Instances of this class may be used as context managers. """ def __init__(self, command_line): """ |