Skip to content

Commit 64e1933

Browse files
committed
Don’t try and sane the tty if stdin isn’t a tty
1 parent ba1319f commit 64e1933

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cmd2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,9 @@ def postparsing_postcmd(self, stop):
717717
"""
718718
if not sys.platform.startswith('win'):
719719
# Fix those annoying problems that occur with terminal programs like "less" when you pipe to them
720-
proc = subprocess.Popen(shlex.split('stty sane'))
721-
proc.communicate()
720+
if self.stdin.isatty():
721+
proc = subprocess.Popen(shlex.split('stty sane'))
722+
proc.communicate()
722723
return stop
723724

724725
def parseline(self, line):

0 commit comments

Comments
 (0)