Skip to content

Commit 3558d28

Browse files
committed
The fix
1 parent 8c9e243 commit 3558d28

File tree

1 file changed

+3
-1
lines changed
  • internal/interpreters

1 file changed

+3
-1
lines changed

internal/interpreters/r.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ func (i *defaultRInterpreter) CreateLockfile(lockfilePath util.AbsolutePath) err
511511
cmd = "renv::snapshot()"
512512
} else {
513513
escaped := strings.ReplaceAll(lockfilePath.String(), `\`, `\\`)
514-
cmd = fmt.Sprintf(`renv::snapshot(lockfile="%s")`, escaped)
514+
// Use normalizePath to handle Windows paths with spaces and special characters correctly
515+
// mustWork=FALSE prevents errors if the path doesn't exist yet
516+
cmd = fmt.Sprintf(`renv::snapshot(lockfile=normalizePath("%s", mustWork=FALSE))`, escaped)
515517
}
516518
args := []string{"-s", "-e", cmd}
517519
stdout, stderr, err := i.cmdExecutor.RunCommand(rExecutable.String(), args, i.base, i.log)

0 commit comments

Comments
 (0)