change: log redirection mechanism

Rely on native output and error stream printing.
Blocked input reading
pull/812/head
Smaarn 4 years ago
parent 7c061874fb
commit 6c0d2926b8

@ -116,21 +116,12 @@ class DaemonStatus(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:]
ep = subprocess.Popen(script, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
process_registry.register(ep)
print("Bazarr starting...")
ep = subprocess.Popen(script, stdout=None, stderr=None, stdin=subprocess.DEVNULL)
process_registry.register(ep)
try:
while True:
line = ep.stdout.readline()
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()
ep.wait()
process_registry.unregister(ep)
except KeyboardInterrupt:
pass

Loading…
Cancel
Save