summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2017-08-23 17:02:09 -0600
committerJared Crapo <jared@kotfu.net>2017-08-23 17:02:09 -0600
commit41ea474441ef49cae074fe6daa405ad185c64081 (patch)
tree5cd6d057a6f6f90f942bb8b9a3c37f9c13fbc60a
parente3930e185729d837031eadf201da15f668db636f (diff)
downloadcmd2-git-41ea474441ef49cae074fe6daa405ad185c64081.tar.gz
Exit on <control>D when on a tty
-rwxr-xr-xcmd2.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index 7fde6d14..f7a0d042 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -998,6 +998,8 @@ class Cmd(cmd.Cmd):
self.poutput(safe_prompt, end='')
self.stdout.flush()
line = self.stdin.readline()
+ if len(line) == 0:
+ line = 'eof'
else:
# we are reading from a pipe, read the line to see if there is
# anything there, if so, then decide whether to print the