talgalili/installr

whitespace problem

Opened this issue · 2 comments

When using updater() I get the following:
`The file was downloaded successfully into:
C:\Users\Firstname Lastname\AppData\Local\Temp\RtmpA1VGx7/R-4.1.0-win.exe

Running the installer now...
'C:\Users\Firstname' is not recognized as an internal or external command,
operable program or batch file.
[1] FALSE
Warning message:
In shell(install_cmd, wait = wait, ...) :
'C:\Users\Firstname Lastname\AppData\Local\Temp\RtmpA1VGx7/R-4.1.0-win.exe' execution failed with error code 1
`
I believe the issue is related to this, but no matter how deep I dig into the function code I cannot figure out where to change what to make it recognize the path as one string.

Expected behavior
It would be really helpful if there was a way to specify the directory in a way that this could be circumvented.

I think this is one of the downsides of shell/system, you indeed need to escape the spaces.
My guess is if you replace " " in exe_filename with "\\ ", then install_cmd should be fine:

installr/R/install.R

Lines 217 to 221 in cc3f226

if(!is.null(installer_option)){
install_cmd <- paste(exe_filename, installer_option)
} else{
install_cmd <- exe_filename
}
)

Alternatively, installr should switch to system2 which automatically escapes whitespace I believe (it forces you to separate the arguments from the command, so that already helps)