Merge pull request #1675 from pypeclub/bugfix/redirect_stdout_from_gui_executable

Ftrack subprocess handle of stdout/stderr
This commit is contained in:
Jakub Trllo 2021-06-11 16:09:48 +02:00 committed by GitHub
commit fbe01ab2ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,7 +66,16 @@ class SocketThread(threading.Thread):
*self.additional_args,
str(self.port)
)
self.subproc = subprocess.Popen(args, env=env, stdin=subprocess.PIPE)
kwargs = {
"env": env,
"stdin": subprocess.PIPE
}
if not sys.stdout:
# Redirect to devnull if stdout is None
kwargs["stdout"] = subprocess.DEVNULL
kwargs["stderr"] = subprocess.DEVNULL
self.subproc = subprocess.Popen(args, **kwargs)
# Listen for incoming connections
sock.listen(1)