Fix logdog client library on windows.
LOGDOG_STREAM_SERVER_PATH is set to e.g. `net.pipe:LUCILogDogKitchen_1176`
on bots, but the file to open is '\\.\pipe\LUCILogDogKitchen_1176'.
Additionally, specify no-buffering and '+' mode to prevent python from
hanging onto bytes it shouldn't keep and allow the pipe to be re-opened
for multiple streams in the same python process.
R=tandrii@chromium.org
Bug: 910369
Change-Id: I47948856a5ac91f87f61eeee8e56e6e093ec3a96
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1642647
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
diff --git a/recipe_engine/third_party/logdog/stream.py b/recipe_engine/third_party/logdog/stream.py
index 7e02772..5952f66 100644
--- a/recipe_engine/third_party/logdog/stream.py
+++ b/recipe_engine/third_party/logdog/stream.py
@@ -528,14 +528,14 @@
name (str): The name of the Windows named pipe to use (e.g., "\\.\name")
"""
super(_NamedPipeStreamClient, self).__init__(**kwargs)
- self._name = name
+ self._name = '\\\\.\\pipe\\' + name
@classmethod
def _create(cls, value, **kwargs):
return cls(value, **kwargs)
def _connect_raw(self):
- return open(self._name, 'wb')
+ return open(self._name, 'wb+', buffering=0)
_default_registry.register_protocol('net.pipe', _NamedPipeStreamClient)