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

UNC paths as argument throws error #59

Closed
Francismori7 opened this issue Jun 28, 2022 · 10 comments
Closed

UNC paths as argument throws error #59

Francismori7 opened this issue Jun 28, 2022 · 10 comments

Comments

@Francismori7
Copy link

Francismori7 commented Jun 28, 2022

  • Pint Version: 0.2.1
  • PHP Version: 8.0.13 (locally installed on Windows)

Description:

I'm using WSL2 with Sail. At this point, I'm trying to use PHPStorm to automatically run Pint on the current PHP file, which works correctly when I'm on a local path.

The issue comes when you open a project from the WSL UNC path (network share). For instance, my project is located at \\WSL$\UBUNTU\home\morfra\code\XXX

Here is the full error when running the following command:

cmd.exe /D /C call C:\Users\morfra\AppData\Roaming\Composer\vendor\bin\pint.bat \\wsl$\Ubuntu\home\morfra\code\XXX\app\Http\Middleware\RecordPageViewsToActivityLog.php
'\\wsl$\Ubuntu\home\morfra\code\XXX'
In Runner.php line 242:
                                                                                                                       
  Cannot write to file "\\WSL$\UBUNTU\home\morfra\code\refonte-intranet\app\Http\Middleware\RecordPageViewsToActivity  
  Log.php" as it is not writable.

That being said, Windows specifically says "UNC paths are not supported in CMD", but I've never had any issues with other scripts running like that.

Steps To Reproduce:

Run the pint.bat command from Windows against a UNC path:
pint.bat "\\wsl$\Ubuntu\home\morfra\code\XXX\app\Http\Middleware\RecordPageViewsToActivityLog.php"

@driesvints
Copy link
Member

Please include the issue template when submitting issues

@Francismori7
Copy link
Author

Please include the issue template when submitting issues

How was I able to submit an issue without the template? :-/ I swear it wasn't there..!

@driesvints
Copy link
Member

What path did you take to submit it?

@Francismori7
Copy link
Author

What path did you take to submit it?

It was the regular New Issue button on the issues page, which is why I'm surprised.
I went ahead and changed my original issue with the template.

@driesvints
Copy link
Member

This is what I see when I choose a bug report. Did you misclick on feature request?

Screenshot 2022-06-28 at 16 24 55

Screenshot 2022-06-28 at 16 25 00

@nunomaduro
Copy link
Member

@Francismori7 Sorry, but I am familiar with the contents you described in the pull request. Of course, you can always submit a pull request that helps fixing your issue.

@michalkortas
Copy link
Contributor

michalkortas commented Jun 28, 2022

@Francismori7 hey, in this situation I have a little workaroud.

image

Instead running pint.bat from Windows disc directly use your WSL2 Linux console & run pint from mounted Windows disc, just like that:

image

@Francismori7
Copy link
Author

Francismori7 commented Jun 28, 2022

@michalkortas Thanks. That's what I resorted to be doing. However this poses a problem when using it through PHPStorm as a file watcher, it's not something I can configure easily

@plakhin
Copy link

plakhin commented Aug 1, 2022

@Francismori7 not sure if this helps, but once I faced similar issue with running Pest from Sublime Text under WSL2, I've used this command wsl.exe --cd "/home/stan/www/laravel-test" vendor/bin/sail artisan test --filter ExampleTest that you can adapt and try something like this: wsl.exe --cd "/home/morfra/code/XXX" vendor/bin/pint app/Http/Middleware/RecordPageViewsToActivityLog.php

@Francismori7
Copy link
Author

@Francismori7 not sure if this helps, but once I faced similar issue with running Pest from Sublime Text under WSL2, I've used this command wsl.exe --cd "/home/stan/www/laravel-test" vendor/bin/sail artisan test --filter ExampleTest that you can adapt and try something like this: wsl.exe --cd "/home/morfra/code/XXX" vendor/bin/pint app/Http/Middleware/RecordPageViewsToActivityLog.php

This worked very nicely. Thanks for the help!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants