I am using the daemonize (double-fork) code from the cookbook, and have
bumped into a strange issue. This is what my program is doing:
... useful things ...
os.popen('/usr/bin/lp -d printer1 %s' % (filename))
"""cookbook recipe from
... cut 'n paste code ...
#Additional closing of stdio
# this is pretty obscure!
if __name__ == '__main__':
The thing that's strange is that the call to lp never happens... if I
replace daemonize(main) with just main() it works as expected. Is there
some secret requirement on stdin/out for popen/spawn/system calls? I
have tried all three, and they all work when I don't double-fork, but
don't when I do. I can't figure this out at all, and it doesn't help
matters that the problem only occurs in a situation where it is very
hard to debug...