-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DNS Flush for Windows in Python #2529
base: master
Are you sure you want to change the base?
Conversation
Thank you for this @gfyoung. I feel this modification merits discussions beforehand. Firstly, we would want to do this because... ? Secondly, the required readme_template.md file modifications do not appear to be included in this PR. Thirdly we're talking about Windows here, with its vast clusterf of version in userland, users who may or may not have admin privileges, how does doing this in Python help at all? In particular, if it fails, what recourse does the end user have? Run the whole At least the |
Good catch. I'll add those.
The Python script has already incorporated admin-level Windows commands (see #1999) and relevant code here. This PR simply continues what was started. The script prints out that admin privileges are required for flush DNS cache (see [here] (https://github.com/StevenBlack/hosts/blob/master/updateHostsFile.py#L1431-L1440)) and will also print an error message if it fails as part of the PR. If the user has no admin privileges, the script will still run. It just won't flush the DNS cache, which wouldn't be possible anyway because you don't have admin privileges. The |
Thank you for those thoughts @gfyoung. Here's my perspective: well over 90% of support issues here (and in my personal email inbox) are Windows-related. Quite frankly, Windows is a pain in the ass. I don't want to do anything that increases support loading from Windows' userland. This PR strikes me as a solution in search of a problem. There's nothing to gain, but lots to lose. I appreciate your "works on my machine certification" but there are much wider risks here and presently I'm inclined to decline this PR. I'll think about it. |
Windows support is subordinate to other operating systems. The Python script handles everything for non-Windows systems. I shouldn't have to run both the Python script and
Totally get there could be wider risks, but that's why this is a PR. Others are welcome to verify themselves that this change works before this gets merged. |
Actually this change does make sense as long as it still works the same, which I haven't tried since I don't use the hosts this way. I'd say let's wait until more people on Windows try this and confirm it works the same as the previous solution and then merge it. PS. I never used an elevated cmd to flush the DNS on Windows. Is it really needed? |
Good question: I do recall it being required at some point but definitely not needed in more recent versions of Windows. A good follow-up PR would be to remove the
@XhmikosR if you wouldn't mind giving it a try though 😄 |
Windows support is now at parity in the Python code.
47c9e1d
to
22b8b7f
Compare
Finally getting around to this. Title is self-explanatory. Ran locally to confirm it works.
With this feature now in Python,
updateHostsWindows.bat
becomes unnecessary.