mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
4ec1f6b724
commit
2c4463e77f
@ -8,8 +8,17 @@ sys.path.append(os.path.dirname(__file__))
|
|||||||
noisy = gnc_prefs_is_extra_enabled()
|
noisy = gnc_prefs_is_extra_enabled()
|
||||||
if noisy:
|
if noisy:
|
||||||
print "woop", os.path.dirname(__file__)
|
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
|
import pycons.console as cons
|
||||||
|
|
||||||
|
# Restore the SIGTTOU handler
|
||||||
|
signal.signal(signal.SIGTTOU, old_sigttou)
|
||||||
|
|
||||||
if noisy:
|
if noisy:
|
||||||
print "Hello from python!"
|
print "Hello from python!"
|
||||||
print "test", sys.modules.keys()
|
print "test", sys.modules.keys()
|
||||||
|
Loading…
Reference in New Issue
Block a user