diff --git a/src/crystal/main.py b/src/crystal/main.py index 430afa6e..52395738 100644 --- a/src/crystal/main.py +++ b/src/crystal/main.py @@ -286,6 +286,9 @@ def _finish_launch(self, filepath: Optional[str]=None) -> None: from crystal.util.xthreading import is_quitting, set_foreground_thread set_foreground_thread(threading.current_thread()) try: + # (Don't insert anything between set_foreground_thread() and MyApp()) + app = MyApp(redirect=False) + # Start shell if requested if parsed_args.shell: from crystal.shell import Shell @@ -293,8 +296,6 @@ def _finish_launch(self, filepath: Optional[str]=None) -> None: else: shell = None - app = MyApp(redirect=False) - # Starts tests if requested if parsed_args.test is not None: from crystal.util.xthreading import bg_call_later, fg_call_later, has_foreground_thread