diff --git a/src/commands/pint.ts b/src/commands/pint.ts index d36f40a0..8154e0c6 100644 --- a/src/commands/pint.ts +++ b/src/commands/pint.ts @@ -1,4 +1,4 @@ -import { fixFilePath } from "@src/support/php"; +import { fixFilePath, getCommand } from "@src/support/php"; import { statusBarError, statusBarSuccess, @@ -37,7 +37,10 @@ const runPintCommand = ( return; } - const command = `"${pintPath}" ${args}`.trim(); + const phpPath = getCommand(); + + // Without php at the beginning, it won't work on Windows + const command = `${phpPath} "${pintPath}" ${args}`.trim(); cp.exec( command, diff --git a/src/support/php.ts b/src/support/php.ts index 72002dca..2388214b 100644 --- a/src/support/php.ts +++ b/src/support/php.ts @@ -271,6 +271,10 @@ const getHashedFile = (code: string) => { return fixFilePath(hashedFile); }; +export const getCommand = (): string => { + return getCommandTemplate().replace('"{code}"', "").trim(); +}; + export const getCommandTemplate = (): string => { return config("phpCommand", "") || getDefaultPhpCommand(); };