diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-12 01:26:19 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-12 01:26:19 -0400 |
commit | a66f8e8555d6ae1cba5f4a36226b769408ccd931 (patch) | |
tree | 5ad1abdec65dc79317c1de6b064221a148d677a4 /cmd2 | |
parent | f3cd0981f3c0b381f3ca76cc1d5e773cd85dbeae (diff) | |
download | cmd2-git-a66f8e8555d6ae1cba5f4a36226b769408ccd931.tar.gz |
Moved code from deprecated postparsing_postcmd into _run_cmdfinalization_hooks
Diffstat (limited to 'cmd2')
-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: |