(self)
| 110 | self.context = re.sub(pattern, '', self.context, flags=re.DOTALL) |
| 111 | |
| 112 | def run(self): |
| 113 | self.timer.start() |
| 114 | try: |
| 115 | self.session = pexpect.spawn('bash', encoding='utf-8', cwd=self.lean_env_path) |
| 116 | if self.context != None: |
| 117 | self.remove_last_comment() |
| 118 | with tempfile.NamedTemporaryFile(mode='w+', delete=False) as temp: |
| 119 | json.dump({"cmd": self.context}, temp, ensure_ascii=False) |
| 120 | temp.write("\n\n") |
| 121 | temp.flush() |
| 122 | command = f'lake env {self.repl_path}/.lake/build/bin/repl < <(cat {temp.name} -)' |
| 123 | else: |
| 124 | command = f'lake env {self.repl_path}/.lake/build/bin/repl' |
| 125 | |
| 126 | self.session.sendline(command) |
| 127 | self.initialize_check() |
| 128 | self.process_responses() # Continuously process responses |
| 129 | self.stop() |
| 130 | |
| 131 | except Exception as e: |
| 132 | print(f"Session {self.session_id}: An error occurred: {e}") |
| 133 | self.init_complete.set() |
| 134 | self.stop() |
| 135 | |
| 136 | def stop(self): |
| 137 | self.stop_flag = True |
nothing calls this directly
no test coverage detected