-
Notifications
You must be signed in to change notification settings - Fork 78
Fix landrush not working if executed as admin #357
base: master
Are you sure you want to change the base?
Conversation
Could you write one test for that? Your description make sense, but I'm not really sure that simply returning nil will solve that. As far as I can remember, when a method does not have an explicit return, it will return nil.
The linked issue seems like an exception to me. So maybe we just need to add a rescue clause? |
Sorry for the late reply :/
Well, I would if I knew how to do it. To be honest, I'm not a ruby developer and the first time I ever opened a ruby file was to debug this error :)
I understand and due to my inexperience, I obviously can't discuss how this works internally, but this nil fixes the error I had. It's as if without it, the returned value was the array size. Reading this tutorial, it seems like :
In our case, that would probably be the 'interfaces' array (or its size, in order to loop in the 'do'), which does totally explain the error I had.
Wouldn't this be catched by the "rescue StandardError" (I'm assuming it's like a generic "catch(Exception e)") just below ? |
Ops! You are right! I was thinking about other languages when I wrote this. |
@davividal Can you merge and tag this PR ? 🙏 |
@KuiKui no, I can't. |
Hi @hferentschik, |
Issue
On Windows 10, running a
vagrant up
on an admin (power)shell crashes withOpenKey': The system cannot find the file specified.
in update_network_adapter (as described here)Cause
It seems that
get_network_guid
couldn't find the right network adapter while enumerating the registry (and indeed, no adapter has the required address, which might be caused by an underlying issue I've not explored).In that special case, the return value is the size of the
interfaces
array (17 in my case), which makesupdate_network_adapter
try to open registry addressSYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\17
and crash.Fix
Returning nil if the value couldn't be found in the adapters array, will fix the issue as
update_network_adapter
will then proceed to manual configuration and won't try to open an inexistent registry key.