Skip to content

Commit

Permalink
fix: handle paths with spaces in getGlobalEsbuildVersion function (#7571
Browse files Browse the repository at this point in the history
)

* fix: handle paths with spaces in getGlobalEsbuildVersion function

* fix failing test
  • Loading branch information
dxdc committed Sep 18, 2024
1 parent e1d1563 commit 6bd497d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/frameworks/next/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ describe("Next.js utils", () => {
.withArgs("npx which esbuild", { encoding: "utf8" })
.returns(mockBinaryPath + "\n");
execSyncStub
.withArgs(`${mockBinaryPath} --version`, { encoding: "utf8" })
.withArgs(`"${mockBinaryPath}" --version`, { encoding: "utf8" })
.returns(`${mockGlobalVersion}\n`);

const consoleWarnStub = sinon.stub(console, "warn");
Expand Down
2 changes: 1 addition & 1 deletion src/frameworks/next/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export function findEsbuildPath(): string | null {
*/
export function getGlobalEsbuildVersion(binPath: string): string | null {
try {
const versionOutput = execSync(`${binPath} --version`, { encoding: "utf8" })?.trim();
const versionOutput = execSync(`"${binPath}" --version`, { encoding: "utf8" })?.trim();
if (!versionOutput) {
return null;
}
Expand Down

0 comments on commit 6bd497d

Please sign in to comment.