diff options
author | Jared Crapo <jared@kotfu.net> | 2017-08-23 17:02:09 -0600 |
---|---|---|
committer | Jared Crapo <jared@kotfu.net> | 2017-08-23 17:02:09 -0600 |
commit | 41ea474441ef49cae074fe6daa405ad185c64081 (patch) | |
tree | 5cd6d057a6f6f90f942bb8b9a3c37f9c13fbc60a | |
parent | e3930e185729d837031eadf201da15f668db636f (diff) | |
download | cmd2-git-41ea474441ef49cae074fe6daa405ad185c64081.tar.gz |
Exit on <control>D when on a tty
-rwxr-xr-x | cmd2.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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 |