Handle invalid file descriptor in exit#956
Conversation
|
Since this isn't currently tested, should we add a test for this? |
|
I suppose so. I guess one strategy for testing would be to run a simple script as a subprocess with |
Considering the initial failure mode could be triggered by import pyqtgraph as pg
pg.exit()Firing off a subprocess and exiting at the end of it might be a bit overkill, but as long as it's not too much effort I'm a 👍 |
|
Just calling I added a test using a subprocess like I described. I checked that it does fail if you add something like |
|
Welp it didn't pass on MacOS. Maybe the timeout is too small? Maybe the timeout isn't actually necessary, but when I tested with |
Looks like the Python2 CI pipelines aren't happy: |
2ae267f to
61c80d4
Compare
|
Looks like the trick was having no-timeout. Are there consequences to not having one specified? |
|
I mentioned in #956 (comment) that not having a timeout means that if the subprocess hangs for some reason it holds everything up |
well that's less than ideal; looking through the python2 subprocess docs, doesn't look like it supports timeout being specified :/ ...that feature appears to have been added in python 3.3 |
|
Don't we have the |
|
Even with pytest-faulthandler, the test process never finishes without an interrupt. You can see faulthandler output gets printed after 15 seconds, but you still have to send a keyboard interrupt or something to quit. I'll rewrite the test to periodically poll the process. |
5eae6f8 to
c5d0963
Compare
|
Alright I think this is in pretty good shape now |
|
Py2.7 CI is still not happy: Deprecating py2 support cannot happen soon enough 😆 |
b970369 to
c210795
Compare
|
Doesn't help that I pretty much refuse to set up a python2 dev environment. I should use your tox config but I'm afraid it will kill my disk space 😅 Should be good to go now that I've actually waited for the full test matrix to run |
|
LGTM, I'll merge.... I can only imagine how annoying this PR was, thanks for doing it! |
It looks to me like the special case of file descriptor 7 on OSX can't be handled with a try/except (illegal instruction doesn't raise an exception afaik), so this just brings the implementation for OSX closer to that of
closerange(see https://docs.python.org/3/library/os.html#os.closerange).Fixes #552