use fork() and a tmpfile for communication as '-|' is not portable