Closed wbond closed 9 years ago
Wow thanks!
I should note that I believe you need to change floobits.py
to try and import select
before failing with an error on ST2/Windows,
Thanks for the PR. I changed our plugin to correctly detect the select
module. Unfortunately, ST2 on Windows is still unusable. It looks like it can only do blocking reads on the socket, which causes ST2 to freeze until it's disconnected for inactivity. I'll have to look into this more.
I believe you are hitting the lockup due to these lines: https://github.com/Floobits/floobits-sublime/blob/master/floo/common/protocols/floo_proto.py#L281-L290.
Right after select.select()
returns a valid socket to read, https://github.com/Floobits/floobits-sublime/blob/master/floo/common/reactor.py#L141 is called. That method enters the while True
loop (https://github.com/Floobits/floobits-sublime/blob/master/floo/common/protocols/floo_proto.py#L281-L290) and reads a value. Then it tries to read again (since the condition is True
) and hangs for 15 seconds. I added a select.select()
call into the while True
loop and that seemed to prevent the hang.
My guess is that the socket module in Python 2 on Windows isn't as polished as Python 3, or posix platforms. Can't say I know for sure. In situations where I had to deal with similar stuff to this (reading data from psftp.exe
on Windows), I used a thread that read a blocking file handle and used a queue to allow for non-blocking reads from the rest of the plugin.
We worked around the Windows PY2 weirdness. Your instructions are valid now. Thanks.
I've updated your readme with useful info for ST2/Windows and Linux users. I also fixed the Package Control link.