diff options
author | Xinchen Hui <laruence@php.net> | 2011-11-17 02:32:21 +0000 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2011-11-17 02:32:21 +0000 |
commit | f2c6e116d2dfc1f385b92b8c2801d3533ac6b844 (patch) | |
tree | d3c670993923d5dfc0c03293e660d3598a71be21 | |
parent | 347876158c182cb05c84845ddb00481f7a634ac3 (diff) | |
download | php-git-f2c6e116d2dfc1f385b92b8c2801d3533ac6b844.tar.gz |
revert my previous change, tests hangs on windows
-rw-r--r-- | sapi/cli/tests/php_cli_server.inc | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 4a8170955b..ab754eb408 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -12,7 +12,7 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) $descriptorspec = array( 0 => STDIN, 1 => STDOUT, - 2 => array("pipe", "w"), + 2 => STDERR, ); if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -21,35 +21,25 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) $cmd .= " {$router}"; } - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true)); + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); } else { $cmd = "exec {$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= " {$router}"; } + $cmd .= " 2>/dev/null"; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } - //@FIXME is there a better way to make sure the process is ready? - usleep(50000); - - stream_set_blocking($pipes[2], 0); - if ($err = stream_get_contents($pipes[2])) { - fclose($pipes[2]); - proc_terminate($handle); - @unlink(__DIR__ . "/{$router}"); - die("Cli sever could not be started: " . $err); - } - register_shutdown_function( - function($handle, $router, $pipes) { - stream_get_contents($pipes[2]); - fclose($pipes[2]); + function($handle) use($router) { proc_terminate($handle); @unlink(__DIR__ . "/{$router}"); }, - $handle, $router, $pipes + $handle ); + usleep(50000); } ?> + |