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: 959887
Change-Id: Iff15fb9de9e39552fc7b063c66e6fbeb6f677d61
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-py/+/1642342
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
NOKEYCHECK=True
GitOrigin-RevId: 90b6d0451314bb57c1e5e45f924478cc34c7f3cc
diff --git a/stream.py b/stream.py
index 7e02772..5952f66 100644
--- a/stream.py
+++ b/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)