Writing pidfile in parent

Hello.

I'm trying to manage application using this library by supervisord (http://supervisord.org/)

Because this library makes fork into the background I need to use pidproxy (as described in http://supervisord.org/subprocess.html#pidproxy-program).

The problem occurs, when parent process finishes, and child process still didn't wrote it's pidfile, and pidproxy fails because it is missing. The pidfile must be present in the directory after parent dies.

Please, move Pidfile writing to parent process, as shown in attached diff.