From 4d6e941709b60f7f6738c908a89824a67ead6c28 Mon Sep 17 00:00:00 2001 From: John Turner Date: Thu, 11 Sep 2025 00:57:12 -0400 Subject: pass stdin.buffer directly to paste method, and catch errors --- pypaste/client/__main__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pypaste/client/__main__.py b/pypaste/client/__main__.py index 6bc2f14..edb4972 100644 --- a/pypaste/client/__main__.py +++ b/pypaste/client/__main__.py @@ -1,4 +1,5 @@ import sys +import io import pkgutil import pypaste.client.plugins as plugins from pypaste.client import PasteService @@ -56,13 +57,11 @@ def main() -> int: return 1 try: - text = sys.stdin.read() - except UnicodeError: - print("failed to decode text") + url = service.paste(sys.stdin.buffer, syntax, args.raw) + except Exception as e: + print(e) return 1 - url = service.paste(text, syntax, args.raw) - print(url) return 0 -- cgit v1.2.3