Skip to content

Commit f60bd8a

Browse files
cristipufuclaude
andcommitted
fix: use detach() instead of close() on utf8_stdout wrapper to preserve shared buffer
When stdout uses non-UTF-8 encoding (e.g. cp1252 on Windows piped mode), the interceptor creates a TextIOWrapper around sys.stdout.buffer. Using close() on teardown destroys the shared buffer, causing ValueError in subsequent stdout writes. detach() disconnects the wrapper without closing the underlying buffer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0fb9be2 commit f60bd8a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.9.1"
3+
version = "0.9.2"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/runtime/logging/_interceptor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ def teardown(self) -> None:
237237
self.log_handler.close()
238238

239239
if hasattr(self, "utf8_stdout"):
240-
self.utf8_stdout.close()
240+
self.utf8_stdout.detach()
241+
del self.utf8_stdout
241242

242243
# Only restore streams if we redirected them
243244
if self.original_stdout and self.original_stderr:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)