diff options
| author | Michael Moore <1198206+imichaelmoore@users.noreply.github.com> | 2026-08-17 12:57:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-17 14:57:41 -0500 |
| commit | 8aa2f06489538f7b4eb660f47731f84edacf006f (patch) | |
| tree | d980c6eab0940252ed2d96f66249760fc681cbd9 /plugins/claude-security/scripts/lib/console.py | |
| parent | f4eb5d70b353a3493655e1451ac7f501ef3d5c67 (diff) | |
Claude Security Plugin - v0.10.1-rc7 (#5403)
Diffstat (limited to 'plugins/claude-security/scripts/lib/console.py')
| -rw-r--r-- | plugins/claude-security/scripts/lib/console.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/claude-security/scripts/lib/console.py b/plugins/claude-security/scripts/lib/console.py new file mode 100644 index 00000000..b8a32635 --- /dev/null +++ b/plugins/claude-security/scripts/lib/console.py @@ -0,0 +1,17 @@ +"""The scripts' console output: undecodable path names and failed removals, printed readably.""" + +from __future__ import annotations + +import io +import sys + + +def tolerate_undecodable_names() -> None: + """Make stdout print an undecodable path name as escapes instead of raising.""" + if isinstance(sys.stdout, io.TextIOWrapper): + sys.stdout.reconfigure(errors="backslashreplace") + + +def removal_failure_detail(error: OSError) -> object: + """The operator-readable reason a tree removal failed.""" + return str(error) if error.strerror or not error.args else error.args[0] |
