Proc::Daemon uses POSIX::close() to close all the existing file descriptors during the daemonising process. However, this seemingly causes a very subtle issue with Expect. If i call
close(STDIN); close(STDOUT); close(STDERR); Proc::Daemon::Init();
then i can use Expect with no problems. However,
just calling Proc::Daemon::Init();
causes Expect to lose track of it's child processes/file handles. Very odd.