Don't add stdin contents to arguments if empty - toot - Unnamed repository; edit this file 'description' to name the repository.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 02e364b52196c5391e20e08dc2fb9de227fa3bed
(DIR) parent 0198bd3af7cbbf367dc6d8152bc8bf535c096cfd
(HTM) Author: Ivan Habunek <ivan@habunek.com>
Date: Sun, 7 May 2017 10:28:11 +0200
Don't add stdin contents to arguments if empty
fixes #11
Diffstat:
toot/console.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/toot/console.py b/toot/console.py
@@ -260,7 +260,9 @@ def main():
# If something is piped in, append it to commandline arguments
if not sys.stdin.isatty():
- sys.argv.append(sys.stdin.read())
+ stdin = sys.stdin.read()
+ if stdin:
+ sys.argv.append(stdin)
command_name = sys.argv[1] if len(sys.argv) > 1 else None
args = sys.argv[2:]