summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-09-11 00:57:12 -0400
committerJohn Turner <jturner.usa@gmail.com>2025-09-11 00:57:12 -0400
commit4d6e941709b60f7f6738c908a89824a67ead6c28 (patch)
tree7e0668ed02f248638ef0d2ffe6fa402536d17d83
parent110cf01f75f95d6115f897e7ba4fe684508a0c96 (diff)
downloadpypaste-4d6e941709b60f7f6738c908a89824a67ead6c28.tar.gz
pass stdin.buffer directly to paste method, and catch errors
-rw-r--r--pypaste/client/__main__.py9
1 files 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