mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-13 00:24:23 +00:00
Addresses issue 635, relating to newlines in Windows. (#678)
This commit is contained in:
parent
5dfc73dfb0
commit
b0a6d72b8c
@ -9,6 +9,9 @@ import pathlib
|
|||||||
import argparse
|
import argparse
|
||||||
from autogen import config_list_from_json
|
from autogen import config_list_from_json
|
||||||
|
|
||||||
|
# What platform are we running?
|
||||||
|
IS_WIN32 = sys.platform == "win32"
|
||||||
|
|
||||||
# Location of the global includes dir. The contents of this directory will be copied to the Docker environment.
|
# Location of the global includes dir. The contents of this directory will be copied to the Docker environment.
|
||||||
INCLUDES_DIR = "includes"
|
INCLUDES_DIR = "includes"
|
||||||
|
|
||||||
@ -186,7 +189,7 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600):
|
|||||||
print("Failed to pull image", image_name)
|
print("Failed to pull image", image_name)
|
||||||
|
|
||||||
# Prepare the run script
|
# Prepare the run script
|
||||||
with open(os.path.join(work_dir, "run.sh"), "wt") as f:
|
with open(os.path.join(work_dir, "run.sh"), "wt", newline="\n") as f:
|
||||||
f.write(
|
f.write(
|
||||||
f"""#
|
f"""#
|
||||||
umask 000
|
umask 000
|
||||||
@ -223,7 +226,7 @@ echo SCENARIO COMPLETE !#!#
|
|||||||
if container.status != "exited":
|
if container.status != "exited":
|
||||||
container.stop()
|
container.stop()
|
||||||
|
|
||||||
logs = container.logs().decode("utf-8").rstrip() + "\nDocker timed out."
|
logs = container.logs().decode("utf-8").rstrip() + "\nDocker timed out.\n"
|
||||||
print(logs)
|
print(logs)
|
||||||
with open(os.path.join(work_dir, "console_log.txt"), "wt") as f:
|
with open(os.path.join(work_dir, "console_log.txt"), "wt") as f:
|
||||||
f.write(logs)
|
f.write(logs)
|
||||||
@ -232,7 +235,7 @@ echo SCENARIO COMPLETE !#!#
|
|||||||
return
|
return
|
||||||
|
|
||||||
# get the container logs
|
# get the container logs
|
||||||
logs = container.logs().decode("utf-8").rstrip()
|
logs = container.logs().decode("utf-8").rstrip() + "\n"
|
||||||
container.remove()
|
container.remove()
|
||||||
|
|
||||||
print(logs)
|
print(logs)
|
||||||
@ -286,6 +289,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Warn if running natively
|
# Warn if running natively
|
||||||
if args.native:
|
if args.native:
|
||||||
|
if IS_WIN32:
|
||||||
|
sys.exit("Running scenarios with --native is not supported in Windows. Exiting.")
|
||||||
|
|
||||||
if args.requirements is not None:
|
if args.requirements is not None:
|
||||||
sys.exit("--requirements is not compatible with --native. Exiting.")
|
sys.exit("--requirements is not compatible with --native. Exiting.")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user