1
0
Fork 0

Replaced proc_open in windowsLogin method with call to Symfony Process Component

pull/2184/head
mwhittom 2013-09-09 15:36:16 -05:00
parent 2e737ac439
commit 114f6c9b6b
1 changed files with 3 additions and 21 deletions

View File

@ -13,6 +13,7 @@
namespace Composer\Util;
use Composer\IO\IOInterface;
use Symfony\Component\Process\Process;
/**
* @author Matt Whittom <Matt.Whittom@veteransunited.com>
@ -350,28 +351,9 @@ class Perforce
public function windowsLogin($password)
{
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'a')
);
$command = $this->generateP4Command(' login -a');
$process = proc_open($command, $descriptorspec, $pipes);
if (!is_resource($process)) {
return false;
}
fwrite($pipes[0], $password);
fclose($pipes[0]);
$this->read($pipes[1], 'Output');
$this->read($pipes[2], 'Error');
fclose($pipes[1]);
fclose($pipes[2]);
$returnCode = proc_close($process);
return $returnCode;
$process = new Process($command, null, null, $password);
return $process->run();
}