talgalili/installr

system("ipconfig", intern = TRUE) fails when installr::updater

Closed this issue · 14 comments

Describe the bug
I wanted to update R from my current 4.0.3 to 4.0.4 with installr::updater, but right after the usual pop-up windows I get the following error:

> installr::updater()
Installing the newest version of R,
 please wait for the installer file to be download and executed.
 Be sure to click 'next' as needed...
Error in system("ipconfig", intern = TRUE) : 'ipconfig' not found

Oddly enough, running system('ipconfig') or system("ipconfig", intern = F) does work and returns a numeric value.

Any hint?

To Reproduce
Simple run of installr::updater, under latest version of Win10, RStudio and R x64 (with and without admin)

Expected behavior
Updating to R 4.0.4

Well, I still haven't figured out the source of my own problem, but I guess it is less general than I thought initially. If you do not have any pointers I will just go for an old fashioned update.

Thanks!

I kind of like this approach from https://stackoverflow.com/a/34970085/1439843:

curl::has_internet
## function(){
##    !is.null(nslookup("google.com", error = FALSE))
## }

that way, problems with system will be avoided.
What numeric value is returned though, when you do system('ipconfig', intern = F)

system('ipconfig', intern = F) returns 127, while curl::has_internet() returns TRUE, as I am connected with a functioning internet connection.
In most cases, I am connected from my workplace, although other Win machines there do upgrade without any problem.

It should return a 0, 127 means there was a problem. Weird, what is the output from

system('ipconfig', intern = T)

?

As per the OP, running system('ipconfig', intern = T) gives Error in system("ipconfig", intern = T) : 'ipconfig' not found

Ah yes, sorry, does shell("ipconfig") work? And running "ipconfig" in a cmd.exe?

ouch, neither is working, maybe I need to checks my env paths?

That's precisely what I found after finding that ipconfig was not working, but my PATH looks fine, the .exe file is in the proper folder.

FWIW, ipconfig works in the Win10 PowerShell, oddly enough.

Yeah, that is weird... However, I'm closing the issue, since it seems it is a problem unique to your Windows installation ;)

Yep, thank you for your suggestions in the meantime tho!