Fix race condition in wfShellExec()
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 18 Jul 2014 20:03:06 +0000 (13:03 -0700)
committerMax Semenik <maxsem.wiki@gmail.com>
Tue, 22 Jul 2014 06:21:23 +0000 (23:21 -0700)
commit9f522988b8b12c59131e394875cc2ecefc89a28d
tree5891e7fbf479f6510b4befc5e2c28a5de97005c2
parentb8c038f6784ef08205f7cf6d7cc11462140e3fa2
Fix race condition in wfShellExec()

Especially when executing commands that return a relatively lot of data in stdout
quickly, proc_get_status() may return that command has terminated before everything
has been read from pipes. Handle this case by continuing to perform
non-blocking select on the process's streams until all remaining data has been
read.

Bug: 67870
Change-Id: I050292dbb76821f66a15f937bf3aaf4defe67687
includes/GlobalFunctions.php
tests/phpunit/includes/GlobalFunctions/wfShellExecTest.php [new file with mode: 0644]