it::fopen('/dev/null', 'r'), 1 => it::fopen('/dev/null', 'w'), 2 => array('pipe', 'w')), $pipes ); register_shutdown_function( function ($server) { proc_terminate($server); }, $server ); usleep(100000); stream_set_blocking($pipes[2], 0); function server_output() { $result = array(); while (($result[] = trim(fgets($GLOBALS['pipes'][2])))) {}; return array_filter($result); } function handle_server($args) { $res = true; foreach ((array)$args as $arg) $res = $res && $arg; $output = server_output(); if (!$res) diag($output); else return $output; }