From: Moritz Kiefer Date: Wed, 5 Jun 2019 11:58:20 +0000 (+0200) Subject: Fix various issues encountered on Windows X-Git-Tag: 0.5.3.0~4^2 X-Git-Url: http://git.lukelau.me/?a=commitdiff_plain;h=3c7aa3a876b2142ceae3b649fbb5bd80e95aff77;hp=3c7aa3a876b2142ceae3b649fbb5bd80e95aff77;p=lsp-test.git Fix various issues encountered on Windows There are a few things going on here, some specific to Windows and some are race conditions that are just easier to hit on Windows but can be reproduced on Linux if you add some delays. 1. You can’t kill threads on Windows that are blocked in an hGet. So what you have to do is to make the hGet fail somehow, e.g., by terminating the process that the hGet is reading from which will make hGet fail. 2. You already terminate the process by sending the exit notification. However, there is a race condition where listenServer will throw an UnexpectedServerTermination exception after the server has terminated as a result of the exit notification. On Linux, you usually get lucky and end up killing the listenServer thread first but due to 1 you always hit this on Windows. If you add a delay after sending the exit notification you can also reproduce this on Linux. 3. You need to set the handles to binary mode. Otherwise you end up with newline conversions turning \r\n into \n which will cause parse errors. ---