[Process] In edge cases getcwd()
can return false
, then proc_open()
should get null
to use default value (the working dir of the current PHP process)
This commit is contained in:
parent
835c1b8615
commit
880da01c49
@ -53,7 +53,7 @@ class Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->commandline = $commandline;
|
$this->commandline = $commandline;
|
||||||
$this->cwd = null === $cwd ? getcwd() : $cwd;
|
$this->cwd = $cwd;
|
||||||
if (null !== $env) {
|
if (null !== $env) {
|
||||||
$this->env = array();
|
$this->env = array();
|
||||||
foreach ($env as $key => $value) {
|
foreach ($env as $key => $value) {
|
||||||
@ -359,6 +359,13 @@ class Process
|
|||||||
*/
|
*/
|
||||||
public function getWorkingDirectory()
|
public function getWorkingDirectory()
|
||||||
{
|
{
|
||||||
|
// This is for BC only
|
||||||
|
if (null === $this->cwd) {
|
||||||
|
// getcwd() will return false if any one of the parent directories does not have
|
||||||
|
// the readable or search mode set, even if the current directory does
|
||||||
|
return getcwd() ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->cwd;
|
return $this->cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user