mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Fix crash when --daemon is given (Python 3).
This commit is contained in:
parent
dce3c97fe4
commit
46b89cfc0e
@ -44,6 +44,7 @@ import shutil
|
||||
import signal
|
||||
if sys.version_info[0] < 3:
|
||||
import cStringIO as StringIO
|
||||
StringIO = StringIO.StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
|
||||
@ -273,8 +274,8 @@ if __name__ == '__main__':
|
||||
# level WARNING on upkeep.
|
||||
sys.stdout.close()
|
||||
sys.stderr.close()
|
||||
sys.stdout = StringIO.StringIO()
|
||||
sys.stderr = StringIO.StringIO()
|
||||
sys.stdout = StringIO()
|
||||
sys.stderr = StringIO()
|
||||
# We have to be really methodical here.
|
||||
os.close(0)
|
||||
os.close(1)
|
||||
|
@ -149,6 +149,8 @@ def upkeep():
|
||||
except IOError: # Win98 sux0rs!
|
||||
pass
|
||||
if conf.daemonized:
|
||||
if sys.version_info[0] >= 3:
|
||||
from io import TextIOWrapper as file
|
||||
# If we're daemonized, sys.stdout has been replaced with a StringIO
|
||||
# object, so let's see if anything's been printed, and if so, let's
|
||||
# log.warning it (things shouldn't be printed, and we're more likely
|
||||
|
Loading…
Reference in New Issue
Block a user