Run the command finalization hooks.
(self, stop: bool, statement: Statement | None)
| 2997 | return stop |
| 2998 | |
| 2999 | def _run_cmdfinalization_hooks(self, stop: bool, statement: Statement | None) -> bool: |
| 3000 | """Run the command finalization hooks.""" |
| 3001 | if self._initial_termios_settings is not None and self.stdin.isatty(): # type: ignore[unreachable] |
| 3002 | import io # type: ignore[unreachable] |
| 3003 | import termios |
| 3004 | |
| 3005 | # Before the next command runs, fix any terminal problems like those |
| 3006 | # caused by certain binary characters having been printed to it. |
| 3007 | with self.sigint_protection, contextlib.suppress(io.UnsupportedOperation, termios.error): |
| 3008 | # This can fail if stdin is a pseudo-TTY, in which case we just ignore it |
| 3009 | termios.tcsetattr(self.stdin.fileno(), termios.TCSANOW, self._initial_termios_settings) |
| 3010 | |
| 3011 | data = plugin.CommandFinalizationData(stop, statement) |
| 3012 | for func in self._cmdfinalization_hooks: |
| 3013 | data = func(data) |
| 3014 | # retrieve the final value of stop, ignoring any |
| 3015 | # modifications to the statement |
| 3016 | return data.stop |
| 3017 | |
| 3018 | def runcmds_plus_hooks( |
| 3019 | self, |
no test coverage detected