From c86aaca2b61d1348285dd67576355b0788c5c4f7 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 29 May 2023 12:56:25 -0700 Subject: [PATCH] Init cli submodule --- intake/__main__.py | 4 +++- intake/cli.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 intake/cli.py diff --git a/intake/__main__.py b/intake/__main__.py index e75154b..4e28416 100644 --- a/intake/__main__.py +++ b/intake/__main__.py @@ -1 +1,3 @@ -print("hello world") \ No newline at end of file +from .cli import main + +main() diff --git a/intake/cli.py b/intake/cli.py new file mode 100644 index 0000000..bf513cd --- /dev/null +++ b/intake/cli.py @@ -0,0 +1,11 @@ +import os +import sys + +def main(): + try: + print("Hello, world!") + except BrokenPipeError: + # See https://docs.python.org/3.10/library/signal.html#note-on-sigpipe + devnull = os.open(os.devnull, os.O_WRONLY) + os.dup2(devnull, sys.stdout.fileno()) + sys.exit(1)