Avoid setting unsuported parameter for subprocess.Popen on Windows

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2020-12-17 12:09:27 +01:00 committed by Ulysses Souza
parent 4757eea80c
commit 3ec7fee736
1 changed files with 6 additions and 1 deletions

View File

@ -42,12 +42,17 @@ class SSHSocket(socket.socket):
port,
'docker system dial-stdio'
]
preexec_func = None
if not constants.IS_WINDOWS_PLATFORM:
preexec_func = lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)
self.proc = subprocess.Popen(
' '.join(args),
shell=True,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
preexec_fn=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN))
preexec_fn=preexec_func)
def _write(self, data):
if not self.proc or self.proc.stdin.closed: