summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcmd2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index d22ce41c..2b99a7ab 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -717,8 +717,9 @@ class Cmd(cmd.Cmd):
"""
if not sys.platform.startswith('win'):
# Fix those annoying problems that occur with terminal programs like "less" when you pipe to them
- proc = subprocess.Popen(shlex.split('stty sane'))
- proc.communicate()
+ if self.stdin.isatty():
+ proc = subprocess.Popen(shlex.split('stty sane'))
+ proc.communicate()
return stop
def parseline(self, line):