diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-12 12:49:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 12:49:49 -0400 |
commit | 3c136483fa35c0545792757aea92d7afb38f70cc (patch) | |
tree | f6a033b0ce3ee116d96f165d8ad8e5781f7dfdc1 | |
parent | ebcd3806451aeaa6fa92aa5b5a41d811cce3fb14 (diff) | |
parent | b50d41913d31a735c3d02c532ce4ca45f1b04a46 (diff) | |
download | cmd2-git-3c136483fa35c0545792757aea92d7afb38f70cc.tar.gz |
Merge branch 'master' into redundant_dependencies
-rw-r--r-- | cmd2/cmd2.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index cc656e01..fb929078 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1701,12 +1701,6 @@ class Cmd(cmd.Cmd): :param stop: bool - True implies the entire application should exit. :return: bool - True implies the entire application should exit. """ - if not sys.platform.startswith('win'): - # Fix those annoying problems that occur with terminal programs like "less" when you pipe to them - if self.stdin.isatty(): - import subprocess - proc = subprocess.Popen(shlex.split('stty sane')) - proc.communicate() return stop def parseline(self, line: str) -> Tuple[str, str, str]: @@ -1801,6 +1795,14 @@ class Cmd(cmd.Cmd): def _run_cmdfinalization_hooks(self, stop: bool, statement: Optional[Statement]) -> bool: """Run the command finalization hooks""" + + if not sys.platform.startswith('win'): + # Fix those annoying problems that occur with terminal programs like "less" when you pipe to them + if self.stdin.isatty(): + import subprocess + proc = subprocess.Popen(shlex.split('stty sane')) + proc.communicate() + try: data = plugin.CommandFinalizationData(stop, statement) for func in self._cmdfinalization_hooks: |