I'm having trouble with sending
shutdown -h 0 to a
lxc Debian container (i.e. executing this command in the lxc) with with the python
pexpect module (in a python script). In this module the user can "expect" (= wait for process output) a certain substring, amongst others EOF, which leads me to the question in order to be able to debug further why EOF isn't recognized in the output. I need to know what I can "expect" after termination of the process in order to wait for the process to end. I can't simply wait for the process because the
pexpect module hides non-blocking functions for that.
pexpect module (see http://www.bx.psu.edu/~nate/pexpect/pexpect.html#pexpect.spawn.expect for details) wraps the reception of EOF in the read system call in a (duck)type and makes it usable in
pexpect.expect (an encapsulation of possible output/feedback of a process).
I've been wondering that because some processes like
ls are expected to terminate with EOF, i.e. the
pexpect sense of EOF (example at http://pexpect.sourceforge.net/pexpect.html).