summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pypaste/client/__main__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pypaste/client/__main__.py b/pypaste/client/__main__.py
index d424603..fabf50c 100644
--- a/pypaste/client/__main__.py
+++ b/pypaste/client/__main__.py
@@ -79,6 +79,14 @@ def main() -> int:
elif (command := args.command) is not None:
cmd = shlex.split(command, posix=True)
proc = subprocess.run(cmd, capture_output=True, text=True, shell=True)
+
+ if proc.returncode != 0:
+ print(
+ f"{command} failed with exit code: {proc.returncode}:{proc.stdout}",
+ file=sys.stderr,
+ )
+ return 1
+
text = f"# {command}\n{proc.stdout}"
else:
return 0