mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-30 04:16:49 +02: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
|
import signal
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
import cStringIO as StringIO
|
import cStringIO as StringIO
|
||||||
|
StringIO = StringIO.StringIO
|
||||||
else:
|
else:
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
@ -273,8 +274,8 @@ if __name__ == '__main__':
|
|||||||
# level WARNING on upkeep.
|
# level WARNING on upkeep.
|
||||||
sys.stdout.close()
|
sys.stdout.close()
|
||||||
sys.stderr.close()
|
sys.stderr.close()
|
||||||
sys.stdout = StringIO.StringIO()
|
sys.stdout = StringIO()
|
||||||
sys.stderr = StringIO.StringIO()
|
sys.stderr = StringIO()
|
||||||
# We have to be really methodical here.
|
# We have to be really methodical here.
|
||||||
os.close(0)
|
os.close(0)
|
||||||
os.close(1)
|
os.close(1)
|
||||||
|
@ -149,6 +149,8 @@ def upkeep():
|
|||||||
except IOError: # Win98 sux0rs!
|
except IOError: # Win98 sux0rs!
|
||||||
pass
|
pass
|
||||||
if conf.daemonized:
|
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
|
# 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
|
# 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
|
# log.warning it (things shouldn't be printed, and we're more likely
|
||||||
|
Loading…
x
Reference in New Issue
Block a user