-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for suspend and resume. #3727
Comments
While the bulk of this is now in place, I have run into one problem when it comes to ╭─────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────╮
│ /Users/davep/develop/python/textual/src/textual/app.py:3375 in action_suspend_process │
│ │
│ 3372 │ │ """ │
│ 3373 │ │ if not WINDOWS: │
│ 3374 │ │ │ try: │
│ ❱ 3375 │ │ │ │ with self.suspend(): │
│ 3376 │ │ │ │ │ os.kill(os.getpid(), signal.SIGTSTP) │
│ 3377 │ │ │ except SuspendNotSupported: │
│ 3378 │ │ │ │ pass │
│ │
│ ╭────────────────────────── locals ───────────────────────────╮ │
│ │ self = SplashApp(title='SplashApp', classes={'-dark-mode'}) │ │
│ ╰─────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/davep/.pyenv/versions/3.11.6/lib/python3.11/contextlib.py:144 in __exit__ │
│ │
│ 141 │ def __exit__(self, typ, value, traceback): │
│ 142 │ │ if typ is None: │
│ 143 │ │ │ try: │
│ ❱ 144 │ │ │ │ next(self.gen) │
│ 145 │ │ │ except StopIteration: │
│ 146 │ │ │ │ return False │
│ 147 │ │ │ else: │
│ │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮ │
│ │ self = <contextlib._GeneratorContextManager object at 0x106af29d0> │ │
│ │ traceback = None │ │
│ │ typ = None │ │
│ │ value = None │ │
│ ╰─────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/davep/develop/python/textual/src/textual/app.py:3358 in suspend │
│ │
│ 3355 │ │ │ self._driver.close() │
│ 3356 │ │ │ with redirect_stdout(sys.__stdout__), redirect_stderr(sys.__stderr__): │
│ 3357 │ │ │ │ yield │
│ ❱ 3358 │ │ │ self._driver.start_application_mode() │
│ 3359 │ │ │ self.app_resume_signal.publish() │
│ 3360 │ │ else: │
│ 3361 │ │ │ raise SuspendNotSupported( │
│ │
│ ╭────────────────────────── locals ───────────────────────────╮ │
│ │ self = SplashApp(title='SplashApp', classes={'-dark-mode'}) │ │
│ ╰─────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/davep/develop/python/textual/src/textual/drivers/linux_driver.py:167 in start_application_mode │
│ │
│ 164 │ │ │ # defaults to ASCII EOT = Ctrl-D = 4.) │
│ 165 │ │ │ newattr[tty.CC][termios.VMIN] = 1 │
│ 166 │ │ │ │
│ ❱ 167 │ │ │ termios.tcsetattr(self.fileno, termios.TCSANOW, newattr) │
│ 168 │ │ │
│ 169 │ │ self.write("\x1b[?25l") # Hide cursor │
│ 170 │ │ self.write("\033[?1003h\n") │
│ │
│ ╭─────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────╮ │
│ │ loop = <_UnixSelectorEventLoop running=True closed=False debug=False> │ │
│ │ newattr = [ │ │
│ │ │ 26626, │ │
│ │ │ 3, │ │
│ │ │ 19200, │ │
│ │ │ 67, │ │
│ │ │ 9600, │ │
│ │ │ 9600, │ │
│ │ │ [ │ │
│ │ │ │ b'\x04', │ │
│ │ │ │ b'\xff', │ │
│ │ │ │ b'\xff', │ │
│ │ │ │ b'\x7f', │ │
│ │ │ │ b'\x17', │ │
│ │ │ │ b'\x15', │ │
│ │ │ │ b'\x12', │ │
│ │ │ │ b'\xff', │ │
│ │ │ │ b'\x03', │ │
│ │ │ │ b'\xff', │ │
│ │ │ │ ... +10 │ │
│ │ │ ] │ │
│ │ ] │ │
│ │ on_terminal_resize = <function LinuxDriver.start_application_mode.<locals>.on_terminal_resize at 0x106a5fc40> │ │
│ │ self = <LinuxDriver SplashApp(title='SplashApp', classes={'-dark-mode'})> │ │
│ │ send_size_event = <function LinuxDriver.start_application_mode.<locals>.send_size_event at 0x106a5c220> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
error: (4, 'Interrupted system call') Attempting something similar with It's also worth noting that this mostly works fine with Midnight Commander (as another example app to test), although I have managed to get it into a state where it's failing to properly process non-alphanumeric keys or mouse input. |
+1d |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Textual swallows ctrl+Z which would normally allow the user to suspend the app. We should restore this behaviour.
There many be another issue for this somewhere, and some initial work.
This may require a little work on the driver code. Bear in mind there are several concrete implementations and we want to avoid breaking them. Suggest talking this through with @willmcgugan once you have a plan for this.
2d
The text was updated successfully, but these errors were encountered: