Closed ghost closed 9 years ago
I agree with the idea, but did you test the os.dup
magic on different platforms? That sounds like the kind of thing that will break horribly on Windows (and I don't want to be the one to resolve it if it does).
Sadly I do not have environment setup to test it in its entirety on Windows, but I did running the following script on Windows using both Python 2.7.9 and 3.4.3 without any problems:
import os, webbrowser
savout = os.dup(1)
os.close(1)
os.open(os.devnull, os.O_RDWR)
try:
webbrowser.open('https://nodejs.org/api/')
finally:
os.dup2(savout, 1)
All right. I was also unable to find a less scary-looking solution. I've merged this as 63f7f56
Whenever I opened the documentation with my browser I ended up receiving the stderr / stdio of Chromium inside vim. This fix temporarily redirects the output to /dev/null.
Before:
After using :TernDocBrowse
Obviously my Chromium has seen better days, but no matter the length of the message it is still annoying: