Skip to content

Conversation

@bizmate
Copy link
Contributor

@bizmate bizmate commented Feb 6, 2014

Fixes: Generating code coverage report in HTML format ...PHP Warning: exec(): Unable to fork [git describe --tags] in /var/www/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Version.php on line 76

Fixes: Generating code coverage report in HTML format ...PHP Warning:  exec(): Unable to fork [git describe --tags] in /var/www/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Version.php on line 76
@sebastianbergmann
Copy link
Owner

I'd rather fix the problem than hide it. Why does the exec() not work?

@bizmate
Copy link
Contributor Author

bizmate commented Feb 7, 2014

From what i have seen so far the forking is happening probably due to system security limitations on number of processes, a limit on some systems you might not be able to change if you have no admin rights.

Overall however i dont like suppressing the warning either but for the purpose of this class and the generic use case of a failed exec it makes no difference in the result that is returned by the id() function.

Also you are just checking for the presence of the .git folder. That does not necessarily mean you have git installed as files might be copied or loaded from a share/folder on a remote machine. Ideally presence of git should also be checked programmatically i would expect. But this is an overhead for what is needed here.

If you are not happy about suppressing the error, maybe handle it by returning an undefined version response when exec fails.

Maybe something like
$version = @exec('git describe --tags', $exResult);

if($exResult != 0)
return 'undefined';

@bizmate
Copy link
Contributor Author

bizmate commented Feb 12, 2014

Hi sebastian, this issue will keep happening unless the code is changed, any plans to check it? if not maybe there is a the possibility to override the code coverage dependency in composer to use another repo?

sebastianbergmann added a commit to sebastianbergmann/version that referenced this pull request Feb 12, 2014
sebastianbergmann added a commit that referenced this pull request Feb 12, 2014
Suppressing warnings when running exec.
@sebastianbergmann sebastianbergmann merged commit 34d4ff4 into sebastianbergmann:1.2 Feb 12, 2014
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.

2 participants