Skip to content

Commit 44c6e01

Browse files
committed
fix(ripgrep): inline paths in PowerShell Expand-Archive command
PowerShell's -Command parameter does not reliably populate $args from trailing positional arguments (especially Windows PowerShell 5.x). This caused Expand-Archive to fail with "argument is null or empty" when extracting the ripgrep archive on Windows. Inline the archive and destination paths directly into the command string with proper single-quote escaping instead of relying on $args. Fixes anomalyco#23457
1 parent 6e01786 commit 44c6e01

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/opencode/src/file/ripgrep.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | ChildPro
252252

253253
if (config.extension === "zip") {
254254
const shell = (yield* Effect.sync(() => which("powershell.exe") ?? which("pwsh.exe"))) ?? "powershell.exe"
255+
const escapedArchive = archive.replace(/'/g, "''")
256+
const escapedDir = dir.replace(/'/g, "''")
255257
const result = yield* run(shell, [
256258
"-NoProfile",
257259
"-Command",
258-
"Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force",
259-
archive,
260-
dir,
260+
`Expand-Archive -LiteralPath '${escapedArchive}' -DestinationPath '${escapedDir}' -Force`,
261261
])
262262
if (result.code !== 0) {
263263
return yield* Effect.fail(error(result.stderr || result.stdout, result.code))

0 commit comments

Comments
 (0)