Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addresses issue 635, relating to newlines in Windows. #678

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions samples/tools/testbed/run_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import argparse
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.
INCLUDES_DIR = "includes"

Expand Down Expand Up @@ -186,7 +189,7 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600):
print("Failed to pull image", image_name)

# 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"""#
umask 000
Expand Down Expand Up @@ -223,7 +226,7 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600):
if container.status != "exited":
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)
with open(os.path.join(work_dir, "console_log.txt"), "wt") as f:
f.write(logs)
Expand All @@ -232,7 +235,7 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600):
return

# get the container logs
logs = container.logs().decode("utf-8").rstrip()
logs = container.logs().decode("utf-8").rstrip() + "\n"
container.remove()

print(logs)
Expand Down Expand Up @@ -286,6 +289,9 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600):

# Warn if running natively
if args.native:
if IS_WIN32:
sys.exit("Running scenarios with --native is not supported in Windows. Exiting.")

if args.requirements is not None:
sys.exit("--requirements is not compatible with --native. Exiting.")

Expand Down
Loading