title: Getting the PID from popen
body: <p>I have a program that uses <code>popen()</code> in order to open and read the output from a shell command. The problem is, as far as I can tell, there is no easy way to get the PID of the running process, and hence, you can't kill it if it gets stuck. So the question is, how can you retrieve the PID from a process opened with <code>popen</code>?</p>