redirect stdout of ftrack process to devnull if sys.stdout is None

This commit is contained in:
iLLiCiTiT 2021-06-09 20:20:08 +02:00
parent 3122ddfb2e
commit 311c1c21bf

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)