proc_open() resources and their destruction

From: Date: Thu, 12 Jul 2012 15:09:26 +0000
Subject: proc_open() resources and their destruction
Groups: php.internals 
Request: Send a blank email to internals+get-61168@lists.php.net to get a copy of this message
Hello, When you create process with proc_open() (or popen()) you'll get a process-resource. The destructor of this resource calls waitpid() (or it's Windows-equivalent) and waits for the childprocess to die. I think it is very counter-intuïtive that when you derefence the resource it will wait, possibly forever, for the process to exit. This also makes it hard to start a process which should outlive the current process. To maintain BC and give users a way to wait for the process I think proc_close() should still wait for the process, but in case the resource gets dereferenced I would like to change the behaviour. I doubt anyone is relying on the current behaviour if they don't call proc_close(). An implementation is quite simple: https://github.com/Jille/php-src/commit/31a1aa384c29487e077ccf3fd067eca188cf1201 -- Jille

« previous php.internals (#61168) next »