Skip to content

[PhpUnitBridge] Fix phpunit symlink on Windows #40754

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 1 commit into from
Apr 11, 2021

Conversation

johnstevenson
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

If the symlink to .phpunit/phpunit already exists, unlink is called to remove it. But this fails on Windows (because it is a directory and requires rmdir), which in turn causes the subsequent symlink call to fail (because it already exists).

Additionally, creating symlinks on Windows requires Administrator permissions (generally), so .phpunit/phpunit can never be created for ordinary Users.

This PR uses a junction instead of a symlink on Windows. It also fixes some issues with stderror output and adds some argument escaping.

@carsonbot
Copy link

Hey!

I think @ro0NL has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@nicolas-grekas
Copy link
Member

Thank you @johnstevenson.

@nicolas-grekas nicolas-grekas merged commit 4a8ea40 into symfony:4.4 Apr 11, 2021
@johnstevenson johnstevenson deleted the symlink-bug branch April 11, 2021 17:52
This was referenced May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants