MCPcopy Index your code
hub / github.com/bpython/bpython / focus_on_subprocess

Method focus_on_subprocess

bpython/curtsiesfrontend/repl.py:2067–2087  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

2065 return s
2066
2067 def focus_on_subprocess(self, args):
2068 prev_sigwinch_handler = signal.getsignal(signal.SIGWINCH)
2069 try:
2070 signal.signal(signal.SIGWINCH, self.orig_sigwinch_handler)
2071 with Termmode(self.orig_stdin, self.orig_tcattrs):
2072 terminal = self.window.t
2073 with terminal.fullscreen():
2074 sys.__stdout__.write(terminal.save)
2075 sys.__stdout__.write(terminal.move(0, 0))
2076 sys.__stdout__.flush()
2077 p = subprocess.Popen(
2078 args,
2079 stdin=self.orig_stdin,
2080 stderr=sys.__stderr__,
2081 stdout=sys.__stdout__,
2082 )
2083 p.wait()
2084 sys.__stdout__.write(terminal.restore)
2085 sys.__stdout__.flush()
2086 finally:
2087 signal.signal(signal.SIGWINCH, prev_sigwinch_handler)
2088
2089 def pager(self, text: str, title: str = "") -> None:
2090 """Runs an external pager on text"""

Callers 1

pagerMethod · 0.95

Calls 2

writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected