Skip to content

Commit 004e181

Browse files
Copilottheoephraim
andauthored
fix: use execFileSync in execSyncVarlock to handle paths with spaces (#543)
* Initial plan * fix: use execFileSync to handle paths with spaces in execSyncVarlock Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/dc30e1d2-49c8-4bcf-8dd2-303af699f9ce Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
1 parent 0d25aa5 commit 004e181

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.changeset/fix-spaces-in-path.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"varlock": patch
3+
---
4+
5+
Fix execSyncVarlock breaking when project path contains spaces
6+
7+
Use `execFileSync` instead of `execSync` for the fallback varlock path resolution to avoid shell interpretation of spaces in directory paths.

packages/varlock/src/lib/exec-sync-varlock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'node:path';
22
import fs from 'node:fs';
33
import os from 'node:os';
4-
import { execSync } from 'node:child_process';
4+
import { execFileSync, execSync } from 'node:child_process';
55

66
// weird tsup issue using `typeof execSync` from node:child_process
77
// see https://github.com/egoist/tsup/issues/1367
@@ -49,7 +49,7 @@ export function execSyncVarlock(
4949
if (fs.existsSync(possibleBinPath)) {
5050
const possibleVarlockPath = path.join(possibleBinPath, 'varlock');
5151
if (fs.existsSync(possibleVarlockPath)) {
52-
const result = execSync(`${possibleVarlockPath} ${command}`, {
52+
const result = execFileSync(possibleVarlockPath, command.split(' '), {
5353
...opts,
5454
stdio: 'pipe',
5555
});

0 commit comments

Comments
 (0)