mirror of
https://github.com/powerline/powerline.git
synced 2025-07-27 07:44:36 +02:00
Use open
to open file descriptors in place of file
Reason: there is no `file()` in Python 3.
Fix was originally presented by @kovidgoyal in [3deb69][1], but I cannot
cherry-pick this commit, because its commit message is highly undescriptive.
Fixes #1008
[1]: 3deb6988c8
This commit is contained in:
parent
6e128c14ba
commit
74d147a0be
@ -274,9 +274,9 @@ def daemonize(stdin=os.devnull, stdout=os.devnull, stderr=os.devnull):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Redirect standard file descriptors.
|
# Redirect standard file descriptors.
|
||||||
si = file(stdin, 'r')
|
si = open(stdin, 'rb')
|
||||||
so = file(stdout, 'a+')
|
so = open(stdout, 'a+b')
|
||||||
se = file(stderr, 'a+', 0)
|
se = open(stderr, 'a+b', 0)
|
||||||
os.dup2(si.fileno(), sys.stdin.fileno())
|
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||||
os.dup2(so.fileno(), sys.stdout.fileno())
|
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||||
os.dup2(se.fileno(), sys.stderr.fileno())
|
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user