Skip to content
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

Adds symfony/process to dependencies to avoid issues on Windows environment #166

Merged
merged 1 commit into from
Jul 2, 2015

Conversation

jeremyb
Copy link
Contributor

@jeremyb jeremyb commented Jun 30, 2015

Hi,

I tried to use this library on a Windows environment and encountered an issue with process execution. I got a "0" as exit status but nothing in stdout... I tried to debug and finally realised that a different behaviour was possible by installing symfony/process package. And it worked well with it.

So, instead of try to deal with Windows environment in the embedded Process class, why not add it to the dependencies? (they already have some code for that: https://github.com/symfony/Process/blob/master/Process.php#L277)

I also think that it's not a good idea to provide two implementations of process execution with a silent configuration (by silent I mean if (class_exists('Symfony\Component\Process\Process')) {}), it doesn't ease the maintenance.

@jeremyb
Copy link
Contributor Author

jeremyb commented Jun 30, 2015

We discussed with @docteurklein that it could be possible to add an Adapter pattern for process execution, a kind of CommandExecutor interface, with an implementation through symfony/process. But for now the executeCommand method returns an array with $process->getExitCode(), $process->getOutput(), $process->getErrorOutput() so a Process is required and probably needs some refactoring IMO.

@docteurklein
Copy link
Contributor

LGTM

}
} else {
$process = new Process($command, $this->env);
$process = new Process($command, NULL, $this->env);
Copy link
Contributor

Choose a reason for hiding this comment

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

NULL should be lowercased according to PSR-2

@jeremyb jeremyb force-pushed the feature/improves-process branch from c166aa5 to 4abf1f3 Compare July 2, 2015 08:38
@jeremyb
Copy link
Contributor Author

jeremyb commented Jul 2, 2015

Done @akovalyov :)

@akovalyov
Copy link
Contributor

LGTM

akovalyov added a commit that referenced this pull request Jul 2, 2015
Adds symfony/process to dependencies to avoid issues on Windows environment
@akovalyov akovalyov merged commit 3aaabad into KnpLabs:master Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants