mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-10 16:57:45 +08:00
Merge pull request #812 from smaarn/fix/rely-on-native-logs
change: log redirection mechanism
This commit is contained in:
commit
f92fc69231
1 changed files with 4 additions and 13 deletions
17
bazarr.py
17
bazarr.py
|
@ -116,21 +116,12 @@ class DaemonStatus(ProcessRegistry):
|
||||||
def start_bazarr(process_registry=ProcessRegistry()):
|
def start_bazarr(process_registry=ProcessRegistry()):
|
||||||
script = [sys.executable, "-u", os.path.normcase(os.path.join(dir_name, 'bazarr', 'main.py'))] + sys.argv[1:]
|
script = [sys.executable, "-u", os.path.normcase(os.path.join(dir_name, 'bazarr', 'main.py'))] + sys.argv[1:]
|
||||||
|
|
||||||
ep = subprocess.Popen(script, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
|
|
||||||
process_registry.register(ep)
|
|
||||||
print("Bazarr starting...")
|
print("Bazarr starting...")
|
||||||
|
ep = subprocess.Popen(script, stdout=None, stderr=None, stdin=subprocess.DEVNULL)
|
||||||
|
process_registry.register(ep)
|
||||||
try:
|
try:
|
||||||
while True:
|
ep.wait()
|
||||||
line = ep.stdout.readline()
|
process_registry.unregister(ep)
|
||||||
if line == '' or not line:
|
|
||||||
# Process ended so let's unregister it
|
|
||||||
process_registry.unregister(ep)
|
|
||||||
break
|
|
||||||
if PY3:
|
|
||||||
sys.stdout.buffer.write(line)
|
|
||||||
else:
|
|
||||||
sys.stdout.write(line)
|
|
||||||
sys.stdout.flush()
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue