mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-23 17:04:21 +01:00
Pass command line args as list (#1486)
Co-authored-by: Nicholas Tindle <nick@ntindle.com> Co-authored-by: k-boikov <64261260+k-boikov@users.noreply.github.com> Co-authored-by: Richard Beales <rich@richbeales.net>
This commit is contained in:
@@ -33,7 +33,7 @@ def execute_python_file(filename: str) -> str:
|
|||||||
|
|
||||||
if we_are_running_in_a_docker_container():
|
if we_are_running_in_a_docker_container():
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
f"python {filename}", capture_output=True, encoding="utf8", shell=True
|
["python", filename], capture_output=True, encoding="utf8"
|
||||||
)
|
)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
return result.stdout
|
return result.stdout
|
||||||
@@ -65,7 +65,7 @@ def execute_python_file(filename: str) -> str:
|
|||||||
logger.info(status)
|
logger.info(status)
|
||||||
container = client.containers.run(
|
container = client.containers.run(
|
||||||
image_name,
|
image_name,
|
||||||
f"python {Path(filename).relative_to(CFG.workspace_path)}",
|
["python", str(Path(filename).relative_to(CFG.workspace_path))],
|
||||||
volumes={
|
volumes={
|
||||||
CFG.workspace_path: {
|
CFG.workspace_path: {
|
||||||
"bind": "/workspace",
|
"bind": "/workspace",
|
||||||
|
|||||||
@@ -75,14 +75,13 @@ Needs improvement.
|
|||||||
Not what I need."""
|
Not what I need."""
|
||||||
# TODO: add questions above, to distract it even more.
|
# TODO: add questions above, to distract it even more.
|
||||||
|
|
||||||
command = f"{sys.executable} -m autogpt"
|
command = [sys.executable, "-m", "autogpt"]
|
||||||
|
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
command,
|
command,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
shell=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
stdout_output, stderr_output = process.communicate(input_data.encode())
|
stdout_output, stderr_output = process.communicate(input_data.encode())
|
||||||
|
|||||||
Reference in New Issue
Block a user