Don't add stdin contents to arguments if empty - toot - Unnamed repository; edi… | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 02e364b52196c5391e20e08dc2fb9de227fa3bed | |
parent 0198bd3af7cbbf367dc6d8152bc8bf535c096cfd | |
Author: Ivan Habunek <[email protected]> | |
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(-) | |
--- | |
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:] |