Don't output to stderr if there is no stderr

This can happen on Windows where the default command line doesn't have a stderr channel. Put it in stdout then.

Fixes #6579.
This commit is contained in:
Ghostkeeper 2019-10-25 14:12:55 +02:00
parent 2abb9842d2
commit 0168a1d5e0
No known key found for this signature in database
GPG Key ID: 59A4C0959592C05C

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import argparse import argparse
@ -131,7 +131,10 @@ def exceptHook(hook_type, value, traceback):
# Set exception hook to use the crash dialog handler # Set exception hook to use the crash dialog handler
sys.excepthook = exceptHook sys.excepthook = exceptHook
# Enable dumping traceback for all threads # Enable dumping traceback for all threads
faulthandler.enable(all_threads = True) if sys.stderr:
faulthandler.enable(file = sys.stderr, all_threads = True)
else:
faulthandler.enable(file = sys.stdout, all_threads = True)
# Workaround for a race condition on certain systems where there # Workaround for a race condition on certain systems where there
# is a race condition between Arcus and PyQt. Importing Arcus # is a race condition between Arcus and PyQt. Importing Arcus