@@ -169,7 +169,7 @@ wsl_safe_path <- function(path = NULL, revert = FALSE) {
169169 } else {
170170 path_already_safe <- grepl(" ^/mnt/" , path )
171171 if (os_is_wsl() && ! isTRUE(path_already_safe ) && ! is.na(path )) {
172- abs_path <- repair_path(path )
172+ abs_path <- repair_path(utils :: shortPathName( path ) )
173173 drive_letter <- tolower(strtrim(abs_path , 1 ))
174174 path <- gsub(paste0(drive_letter , " :" ),
175175 paste0(" /mnt/" , drive_letter ),
@@ -180,15 +180,15 @@ wsl_safe_path <- function(path = NULL, revert = FALSE) {
180180 path
181181}
182182
183+ # Running commands through WSL requires using 'wsl' as the command with the
184+ # intended command (e.g., stanc) as the first argument. This function acts as
185+ # a wrapper around processx::run() to apply this change where necessary, and
186+ # forward all other arguments
183187wsl_compatible_run <- function (... ) {
184188 run_args <- list (... )
185189 if (os_is_wsl()) {
186190 command <- run_args $ command
187191 run_args $ command <- " wsl"
188- if (grepl(" stanc" , command )) {
189- run_args $ args [1 ] <- paste0(" '" , run_args $ args [1 ], " '" )
190- run_args $ windows_verbatim_args <- TRUE
191- }
192192 run_args $ args <- c(command , run_args $ args )
193193 }
194194 do.call(processx :: run , run_args )
0 commit comments