Merge branch 'fix/engineer_edit_fail' of https://gitlab.deepwisdomai.com/pub/MetaGPT into fix/engineer_edit_fail

This commit is contained in:
黄伟韬 2024-09-14 20:57:18 +08:00
commit d6adc24635

View file

@ -110,7 +110,8 @@ class Terminal:
async def _read_and_process_output(self, cmd, daemon=False) -> str:
async with self.observer as observer:
cmd_output = []
await observer.async_report(cmd + self.command_terminator, "cmd")
if cmd != "pwd":
await observer.async_report(cmd + self.command_terminator, "cmd")
# report the command
# Read the output until the unique marker is found.
# We read bytes directly from stdout instead of text because when reading text,
@ -127,12 +128,14 @@ class Terminal:
if ix >= 0:
line = line[0:ix]
if line:
await observer.async_report(line, "output")
if cmd != "pwd":
await observer.async_report(line, "output")
# report stdout in real-time
cmd_output.append(line)
return "".join(cmd_output)
# log stdout in real-time
await observer.async_report(line, "output")
if cmd != "pwd":
await observer.async_report(line, "output")
cmd_output.append(line)
if daemon:
await self.stdout_queue.put(line)