1<?php
2/*
3 * This file is part of PHPUnit.
4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11/**
12 * Windows utility for PHP sub-processes.
13 *
14 * Reading from STDOUT or STDERR hangs forever on Windows if the output is
15 * too large.
16 *
17 * @see https://bugs.php.net/bug.php?id=51800
18 */
19class PHPUnit_Util_PHP_Windows extends PHPUnit_Util_PHP_Default
20{
21    protected $useTempFile = true;
22
23    protected function getHandles()
24    {
25        if (false === $stdout_handle = tmpfile()) {
26            throw new PHPUnit_Framework_Exception(
27                'A temporary file could not be created; verify that your TEMP environment variable is writable'
28            );
29        }
30
31        return [
32            1 => $stdout_handle
33        ];
34    }
35
36    public function getCommand(array $settings, $file = null)
37    {
38        return '"' . parent::getCommand($settings, $file) . '"';
39    }
40}
41