Last active
September 22, 2018 15:47
-
-
Save stmoerman/8f9e38363ea77937fe8c3e8cc31a55d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo OFF | |
setlocal ENABLEDELAYEDEXPANSION | |
rem Collect the arguments and replace: | |
rem '\' with '/' | |
rem 'c:' with 'mnt/c' | |
rem '"' with '\"' | |
set v_params=%* | |
set v_params=%v_params:\=/% | |
set v_params=%v_params:C:=/mnt/c% | |
set v_params=%v_params% | |
set v_params=%v_params:"=\"% | |
rem Call the windows-php inside WSL. | |
rem windows-php is just a script which passes the arguments onto | |
rem the original php executable and converts its output from UNIX | |
rem syntax to Windows syntax. | |
C:\Windows\system32\bash.exe -l -c "windows-php %v_params%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"php.validate.executablePath": "c:\\wsl-tools\\php.bat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this file in /usr/local/bin | |
# Pass all the arguments to PHP. | |
output=$(php "$@") | |
# Perform UNIX->WINDOWS syntax replacements. | |
output="${output//$'\n'/$'\r'$'\n'}" | |
output="${output//\/mnt\/c/C:}" | |
output="${output//\//\\}" | |
# Echo corrected output. | |
echo $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment