From 93688a3ebf745286029d4cb58838ecb7ab5ed8fb Mon Sep 17 00:00:00 2001 From: Romuald Brunet Date: Sun, 15 Mar 2020 10:34:33 +0100 Subject: [PATCH] [dns] handle non-available STDIN The standard input may not alway be available. In that case trying to read from it will raise an IOError. Ignore this error if that happens --- gandi/cli/commands/dns.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gandi/cli/commands/dns.py b/gandi/cli/commands/dns.py index fe6c21c0..17aaf7a9 100644 --- a/gandi/cli/commands/dns.py +++ b/gandi/cli/commands/dns.py @@ -120,7 +120,11 @@ def update(gandi, fqdn, name, type, value, ttl, file): if file: content = file.read() elif not sys.stdin.isatty(): - content = click.get_text_stream('stdin').read() + try: + content = click.get_text_stream('stdin').read() + except IOError: + # stdin may not be available + pass content = content.strip() if not content and not name and not type and not value: