Skip to content

Commit

Permalink
More fixes towards windows conformance
Browse files Browse the repository at this point in the history
  • Loading branch information
OfekShilon committed Dec 21, 2023
1 parent bccfb28 commit 0a0ec50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import errno
import logging
import os
import platform
import shutil
import signal
import subprocess
Expand Down Expand Up @@ -231,14 +232,20 @@ def check_dir_and_create(directory):
print_and_exit("Can't use '" + norm_dir + "' directory")


def run_cmd(cmd, time_out=None, num=-1, memory_limit=None):
def run_cmd(cmd, time_out=None, num=-1, memory_limit=None, compilation_cmd=True):
is_time_expired = False
shell = False
if memory_limit is not None:
shell = True
new_cmd = "ulimit -v " + str(memory_limit) + " ; "
new_cmd += " ".join(i for i in cmd)
cmd = new_cmd
if platform.system() == "Windows" and compilation_cmd:
shell = True
new_cmd = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat ; "
new_cmd += " ".join(i for i in cmd)
cmd = new_cmd

start_time = os.times()
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, start_new_session=True, shell=shell) as process:
try:
Expand Down
3 changes: 3 additions & 0 deletions scripts/run_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import multiprocessing
import multiprocessing.managers
import os
import platform
import re
import shutil
import stat
Expand Down Expand Up @@ -1510,6 +1511,8 @@ def prepare_env_and_start_testing(out_dir, timeout, targets, num_jobs, config_fi

# Check for binary of generator
yarpgen_bin = os.path.abspath(common.yarpgen_scripts + os.sep + "yarpgen")
if(platform.system() == "Windows"):
yarpgen_bin += ".exe"
common.check_and_copy(yarpgen_bin, out_dir)
ret_code, output, err_output, time_expired, elapsed_time = common.run_cmd([yarpgen_bin, "-v"], yarpgen_timeout, 0)
common.yarpgen_version_str = str(output, "utf-8")
Expand Down

0 comments on commit 0a0ec50

Please sign in to comment.