From 827a383baedb95af443f0768be7000ea043436fe Mon Sep 17 00:00:00 2001 From: N1ebieski Date: Tue, 23 Sep 2025 13:18:08 +0000 Subject: [PATCH 1/4] Fix for PHP Command for Pint on Windows Fixes N1ebieski/vs-code-extension#62 --- src/commands/pint.ts | 7 +++++-- src/support/php.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/commands/pint.ts b/src/commands/pint.ts index d36f40a0..88b7007c 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 php = getCommand(); + + // Without php at the beginning, it won't work on Windows + const command = `${php} "${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(); }; From 12ad25e1bff7cf6d3793620b633d335520f9d132 Mon Sep 17 00:00:00 2001 From: N1ebieski Date: Tue, 23 Sep 2025 13:53:51 +0000 Subject: [PATCH 2/4] add double quotes --- src/commands/pint.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/pint.ts b/src/commands/pint.ts index 88b7007c..c45f65df 100644 --- a/src/commands/pint.ts +++ b/src/commands/pint.ts @@ -40,7 +40,7 @@ const runPintCommand = ( const php = getCommand(); // Without php at the beginning, it won't work on Windows - const command = `${php} "${pintPath}" ${args}`.trim(); + const command = `"${php}" "${pintPath}" ${args}`.trim(); cp.exec( command, From 30549b42bf6eea3d03b8f974ec1e543ab4abea59 Mon Sep 17 00:00:00 2001 From: N1ebieski Date: Tue, 23 Sep 2025 13:58:48 +0000 Subject: [PATCH 3/4] refactoring --- src/commands/pint.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/pint.ts b/src/commands/pint.ts index c45f65df..d2ba7c83 100644 --- a/src/commands/pint.ts +++ b/src/commands/pint.ts @@ -37,10 +37,10 @@ const runPintCommand = ( return; } - const php = getCommand(); + const phpPath = getCommand(); // Without php at the beginning, it won't work on Windows - const command = `"${php}" "${pintPath}" ${args}`.trim(); + const command = `"${phpPath}" "${pintPath}" ${args}`.trim(); cp.exec( command, From 5868d3c3154a8f3cc36e7ad46a6f2a6bb21af97f Mon Sep 17 00:00:00 2001 From: N1ebieski Date: Wed, 8 Oct 2025 09:36:46 +0000 Subject: [PATCH 4/4] remove double quotes from phpPath --- src/commands/pint.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/pint.ts b/src/commands/pint.ts index d2ba7c83..8154e0c6 100644 --- a/src/commands/pint.ts +++ b/src/commands/pint.ts @@ -40,7 +40,7 @@ const runPintCommand = ( const phpPath = getCommand(); // Without php at the beginning, it won't work on Windows - const command = `"${phpPath}" "${pintPath}" ${args}`.trim(); + const command = `${phpPath} "${pintPath}" ${args}`.trim(); cp.exec( command,