I’m encountering some problems when trying to run a process
in background and disown it in
zsh with the
I’m no expert of either
so it might very well be that I’m missing something obvious here.
The executable is the following
python program, call it
test.py (I’m using
#!/usr/bin/env python from __future__ import print_function import time for idx in range(5): print(idx) time.sleep(2) with open('test.txt','w') as ofile: ofile.write('done')
With some trial-and-error, I noticed the following:
if I run
./test.py &!and then logout, the process does not complete successfully
(I check this by looking at the presence and content of the file
it looks like it’s not getting disowned, and logging out causes it to stop;
if I run
./test.py > test2.txt &!, and then logout,
it does work as expected (again, based on the presence of the
if I comment out the the second line (
from __future__ ..), modify the
./test.py &!, and then logout, it also works as expected.
What am I missing? And would there be a way to make 1. work, without resorting to 2. or 3.?