mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
daemon: in detached modde, redirect strandard file descriptors
This commit is contained in:
parent
52af40685e
commit
13f3f71125
1 changed files with 10 additions and 0 deletions
10
run_electrum
10
run_electrum
|
@ -363,6 +363,16 @@ if __name__ == '__main__':
|
||||||
if pid:
|
if pid:
|
||||||
print_stderr("starting daemon (PID %d)" % pid)
|
print_stderr("starting daemon (PID %d)" % pid)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
# redirect standard file descriptors
|
||||||
|
sys.stdout.flush()
|
||||||
|
sys.stderr.flush()
|
||||||
|
si = open(os.devnull, 'r')
|
||||||
|
so = open(os.devnull, 'w')
|
||||||
|
se = open(os.devnull, 'w')
|
||||||
|
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||||
|
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||||
|
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||||
|
# run daemon
|
||||||
init_plugins(config, 'cmdline')
|
init_plugins(config, 'cmdline')
|
||||||
d = daemon.Daemon(config, fd)
|
d = daemon.Daemon(config, fd)
|
||||||
if config.get('websocket_server'):
|
if config.get('websocket_server'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue