python - Runing a script in background will hang the subprocess -
i running script launches
run_app.py >& log.out
in run_app.py, start few subprocesses , read stdout/stderr of subprocesses through pipe. can run script fine if try put background by:
run_app.py >& log.out &
the run_app.py hang on reading data subprocess. seems similar thread: ffmpeg hangs when run in background
my subprocess write lot might overflow pipe_buf.
however, redirecting&writing stdout/stderr file. there suggestions might prevent hanging when put script background while able save output in file instead of redirecting them /dev/null?
when background process running, standard i/o streams still connected screen , keyboard. processes suspended (stopped) if try read keyboard.
you should have message saying like: stopped (tty input)
. have been sent shell's stderr.
normally redirecting stdin covers problem, programs access keyboard directly rather using stdin, typically prompting password.
Comments
Post a Comment