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
Fix FIFO for userscripts on Windows #1927
Fix FIFO for userscripts on Windows #1927
Conversation
The userscript FIFO on Windows suffered the same problem that open-editor once did, because files on Windows can't be opened with write access by two different processes. We kept the oshandle around and only closed it when the process exited, which means that userscripts could not actually write any commands to the FIFO. This patch closes the file earlier, allowing the userscript to actually write commands to it. See also https://lists.schokokeks.org/pipermail/qutebrowser/2016-September/000256.html
""" | ||
|
||
def __init__(self, win_id, parent=None): | ||
super().__init__(win_id, parent) | ||
self._oshandle = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the overridden __init__
now.
Seems like some freshly added tests are flaky, I'll take a look. |
Current coverage is 81.63% (diff: 100%)@@ master #1927 diff @@
==========================================
Files 121 121
Lines 16918 16912 -6
Methods 0 0
Messages 0 0
Branches 2589 2589
==========================================
- Hits 13810 13806 -4
+ Misses 2640 2638 -2
Partials 468 468
|
After some fixes and librally skipping everything broken for now, things are back to normal again 😆 |
Right, they are broken here too... My best guess would be that AppVeyor has some cygwin I wonder what the best way to fix them would be - is there an executable which is there and does nothing on Windows/Linux/OS X? Or do we need a |
Seems quite possible, so I'll accept that as an explanation 😜
One for all platforms? Probably not. But if the name can vary, it should be easy to find something for each one separately. For Windows, see this question, or we could drop a simple Or we use some |
On Windows, no echo.exe exists normally, so calling echo from the tests is no good idea, since it relies on Cygwin to be installed and in %PATH% (so that echo.exe is available). This fixes this by providing a small echo.bat which is callable from the tests, and then using a platform-specific path to the executable instead of the hardcoded "echo". This should ensure that the tests pass even on systems where echo.exe is not installed. Note that we can't simply use a do-nothing exe (like rundll or hh.exe), as we're passing parameters, and those executables may behave differently in the presence of those parameters.
Seems unrelated to my changes and fixed in |
Thanks! |
Due to the way Windows handles files, we couldn't actually write to the "FIFO" file from the userscript (same issue as #1767). This patch should fix this problem with the patch from the mailinglist, and it adds a simple test for running a userscript on Windows.
On a somewhat related note: I'm wondering how those tests even pass on AppVeyor -
echo
is not an external command on Windows (there is noecho.exe
), and you can't callecho
viasubprocess
. The tests fail locally, but seem to work fine on AppVeyor... Any idea what magic you used to get it to work? 😉This change is