File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1- import { fixFilePath } from "@src/support/php" ;
1+ import { fixFilePath , getPhpCommand , getPhpEnv } from "@src/support/php" ;
22import {
33 statusBarError ,
44 statusBarSuccess ,
@@ -12,6 +12,7 @@ import { showErrorPopup } from "../support/popup";
1212import {
1313 getWorkspaceFolders ,
1414 projectPath ,
15+ pathForPhpEnv ,
1516 projectPathExists ,
1617} from "../support/project" ;
1718
@@ -27,7 +28,8 @@ const runPintCommand = (
2728) : Promise < string > => {
2829 return new Promise < string > ( ( resolve , reject ) => {
2930 // Check if pint exists in vendor/bin
30- const pintPath = projectPath ( "vendor/bin/pint" ) ;
31+ const pintBin = "vendor/bin/pint" ;
32+ const pintPath = projectPath ( pintBin ) ;
3133
3234 if ( ! projectPathExists ( "vendor/bin/pint" ) ) {
3335 const errorMessage =
@@ -37,7 +39,13 @@ const runPintCommand = (
3739 return ;
3840 }
3941
40- const command = `"${ pintPath } " ${ args } ` . trim ( ) ;
42+ let command = `"${ pintPath } " ${ args } ` . trim ( ) ;
43+
44+ if ( getPhpEnv ( ) !== "local" ) {
45+ const phpcmd = getPhpCommand ( ) ;
46+ const pintInEnv = pathForPhpEnv ( "vendor/bin/pint" ) ;
47+ command = `${ phpcmd } "${ pintInEnv } " ${ args } ` . trim ( ) ;
48+ }
4149
4250 cp . exec (
4351 command ,
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export const initVendorWatchers = () => {
9292 registerWatcher ( autoloadWatcher ) ;
9393} ;
9494
95- const getPhpCommand = ( ) : string => {
95+ export const getPhpCommand = ( ) : string => {
9696 const phpEnv = config < PhpEnvironment > ( "phpEnvironment" , "auto" ) ;
9797
9898 for ( const [ key , option ] of Object . entries ( phpEnvironments ) ) {
You can’t perform that action at this time.
0 commit comments