fix blocks in web

This commit is contained in:
2026-05-21 13:03:12 -03:00
parent 4f3af7ca12
commit cd8eeaad79
+14 -1
View File
@@ -356,6 +356,7 @@ class node:
async def _async_interact_loop(self, local_stream, resize_callback, copilot_handler=None): async def _async_interact_loop(self, local_stream, resize_callback, copilot_handler=None):
local_stream.setup(resize_callback=resize_callback) local_stream.setup(resize_callback=resize_callback)
self.current_local_stream = local_stream
try: try:
child_fd = self.child.child_fd child_fd = self.child.child_fd
@@ -445,7 +446,13 @@ class node:
async def delayed_marker(): async def delayed_marker():
await asyncio.sleep(0.02) await asyncio.sleep(0.02)
if hasattr(self, 'mylog'): if hasattr(self, 'mylog'):
self.cmd_byte_positions.append((self.mylog.tell(), None)) pos = self.mylog.tell()
self.cmd_byte_positions.append((pos, None))
if hasattr(self, 'current_local_stream') and self.current_local_stream is not None:
try:
await self.current_local_stream.write(f'\x1b]133;B;{pos}\x07'.encode())
except Exception:
pass
asyncio.create_task(delayed_marker()) asyncio.create_task(delayed_marker())
try: try:
@@ -569,6 +576,7 @@ class node:
except Exception: except Exception:
pass pass
finally: finally:
self.current_local_stream = None
local_stream.teardown() local_stream.teardown()
@MethodHook @MethodHook
@@ -597,6 +605,11 @@ class node:
if cmd != slc and hasattr(self, 'cmd_byte_positions') and self.cmd_byte_positions is not None: if cmd != slc and hasattr(self, 'cmd_byte_positions') and self.cmd_byte_positions is not None:
log_pos = self.mylog.tell() if hasattr(self, 'mylog') else 0 log_pos = self.mylog.tell() if hasattr(self, 'mylog') else 0
self.cmd_byte_positions.append((log_pos, cmd)) self.cmd_byte_positions.append((log_pos, cmd))
if hasattr(self, 'current_local_stream') and self.current_local_stream is not None:
try:
await self.current_local_stream.write(f'\x1b]133;B;{log_pos}\x07'.encode())
except Exception:
pass
# Write physically to PTY # Write physically to PTY
os.write(child_fd, (cmd + "\n").encode()) os.write(child_fd, (cmd + "\n").encode())