Merge branch 'terminal_env_fix' into 'mgx_ops'

update: terminal初始化的时候把环境变量给过去

See merge request pub/MetaGPT!159
This commit is contained in:
张雷 2024-06-11 08:25:17 +00:00
commit 569a7bcc94

View file

@ -1,3 +1,4 @@
import os
import subprocess
import threading
from queue import Queue
@ -19,6 +20,7 @@ class Terminal:
self.shell_command = ["bash"] # FIXME: should consider windows support later
self.command_terminator = "\n"
env = dict(os.environ)
# Start a persistent shell process
self.process = subprocess.Popen(
self.shell_command,
@ -27,6 +29,7 @@ class Terminal:
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
executable="/bin/bash",
env=env
)
self.stdout_queue = Queue()
self.observer = TerminalReporter()