Permalink
Browse files

make --RETURNS-- work on windows again

make sure we unlink POST data on windows


git-svn-id: http://svn.php.net/repository/pear/pear-core/pear/pear-core/trunk@230096 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 67d55c8 commit 51838865ec200c60ca0ed22cbca73121bd2c17f1 cellog committed Feb 17, 2007
Showing with 13 additions and 9 deletions.
  1. +13 −9 PEAR/RunTest.php
View
22 PEAR/RunTest.php
@@ -293,7 +293,7 @@ function run($file, $ini_settings = '')
$test_skipif = $test_dir . DIRECTORY_SEPARATOR . $main_file_name.'skip.php';
$temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php';
$test_clean = $test_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php';
- $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('/phpt.');
+ $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.');
// unlink old test results
@unlink($diff_filename);
@@ -475,18 +475,22 @@ function run($file, $ini_settings = '')
$cmd = "$php$pass_options$ini_settings -f \"$test_file\" $args 2>&1";
}
- $out = $this->system_with_timeout($cmd, $env,
- isset($section_text['STDIN']) ? $section_text['STDIN'] : null);
- $return_value = $out[0];
- $out = $out[1];
- if (isset($tmp_post) && file_exists($tmp_post)) {
- unlink($tmp_post);
- }
- if (isset($section_text['RETURNS'])) {
+ if (OS_WINDOWS && isset($section_text['RETURNS'])) {
+ ob_start();
+ system($cmd, $return_value);
+ $out = ob_get_contents();
+ ob_end_clean();
$section_text['RETURNS'] = (int) trim($section_text['RETURNS']);
$returnfail = ($return_value != $section_text['RETURNS']);
} else {
$returnfail = false;
+ $out = $this->system_with_timeout($cmd, $env,
+ isset($section_text['STDIN']) ? $section_text['STDIN'] : null);
+ $return_value = $out[0];
+ $out = $out[1];
+ }
+ if (isset($tmp_post) && realpath($tmp_post)) {
+ unlink(realpath($tmp_post));
}
chdir($savedir);

0 comments on commit 5183886

Please sign in to comment.