Ignore SIGTTOU while importing Python console class.

Importing it causes this signal to be sent and if GnuCash is running
in the background it hangs.
This commit is contained in:
Mike Alexander 2014-04-26 14:38:10 -04:00
parent 4ec1f6b724
commit 2c4463e77f

View File

@ -8,8 +8,17 @@ sys.path.append(os.path.dirname(__file__))
noisy = gnc_prefs_is_extra_enabled()
if noisy:
print "woop", os.path.dirname(__file__)
# Importing the console class causes SIGTTOU to be thrown if GnuCash is
# started in the background. This causes a hang if it is not handled,
# so ignore it for the duration
import signal
old_sigttou = signal.signal(signal.SIGTTOU, signal.SIG_IGN)
import pycons.console as cons
# Restore the SIGTTOU handler
signal.signal(signal.SIGTTOU, old_sigttou)
if noisy:
print "Hello from python!"
print "test", sys.modules.keys()