8000 ProcessBuilder clean up by Seldaek · Pull Request #3381 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

ProcessBuilder clean up #3381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 5, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Process] Code clean up
  • Loading branch information
Seldaek committed Feb 16, 2012
commit 4882777c4e29f8af3fac9ab8037d2cd0bbe1599c
8 changes: 2 additions & 6 deletions src/Symfony/Component/Process/ProcessBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProcessBuilder
{
private $arguments;
private $cwd;
private $env;
private $env = array();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the constructor for consistency.

private $stdin;
private $timeout;
private $options;
Expand Down Expand Up @@ -63,10 +63,6 @@ public function inheritEnvironmentVariables($inheritEnv = true)

public function setEnv($name, $value)
{
if (null === $this->env) {
$this->env = array();
}

$this->env[$name] = $value;

return $this;
Expand Down Expand Up @@ -117,7 +113,7 @@ public function getProcess()
$script = implode(' ', array_map('escapeshellarg', $this->arguments));
}

$env = $this->inheritEnv && $_ENV ? ($this->env ?: array()) + $_ENV : $this->env;
$env = $this->inheritEnv && $_ENV ? $this->env + $_ENV : $this->env;

return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options);
}
Expand Down
0