Skip to content

Commit f7da7cb

Browse files
Added management of blank char in path for Popen calls (win only) (#120)
1 parent c16900e commit f7da7cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
if not pythonExecutable:
8989
pythonExecutable = "python"
9090

91+
# adds quotes to sorround path elements that contain blank characters - to be used only for Popen calls under Windows
92+
pythonExecutablePopenWin = os.path.join(*['\"'+i+'\"' if ' ' in i else i+'\\' if ':' in i else i for i in pythonExecutable.split('\\')]) if isWin else ''
93+
9194
def fflush():
9295
sys.stdout.flush()
9396
sys.stderr.flush()
@@ -763,7 +766,7 @@ def runScript(c, timeout, memoryLimit, runverbose):
763766
sys.stdout.flush()
764767

765768
if isWin:
766-
res_cmd = runCommand("%s testmodel.py --win --msysEnvironment=%s --libraries=%s %s --ompython_omhome=%s %s.conf.json > files/%s.cmdout 2>&1" % (pythonExecutable, msysEnvironment, librariespath, ("--docker %s --dockerExtraArgs '%s'" % (docker, " ".join(dockerExtraArgs))) if docker else "", ompython_omhome, c, c), prefix=c, timeout=timeout)
769+
res_cmd = runCommand("%s testmodel.py --win --msysEnvironment=%s --libraries=\"%s\" %s --ompython_omhome=%s %s.conf.json > files/%s.cmdout 2>&1" % (pythonExecutablePopenWin, msysEnvironment, librariespath, ("--docker %s --dockerExtraArgs '%s'" % (docker, " ".join(dockerExtraArgs))) if docker else "", ompython_omhome, c, c), prefix=c, timeout=timeout)
767770
else:
768771
res_cmd = runCommand("ulimit -v %d; ./testmodel.py --libraries=%s %s --ompython_omhome=%s %s.conf.json > files/%s.cmdout 2>&1" % (memoryLimit, librariespath, ("--docker %s --dockerExtraArgs '%s'" % (docker, " ".join(dockerExtraArgs))) if docker else "", ompython_omhome, c, c), prefix=c, timeout=timeout)
769772

@@ -1102,7 +1105,7 @@ def cpu_name():
11021105
try:
11031106
rmtree("files/")
11041107
except:
1105-
print("-- problemduring removing of ./files dir")
1108+
print("-- problem during removing of ./files dir")
11061109

11071110
# Do not commit until we have generated and uploaded the reports
11081111
conn.commit()

0 commit comments

Comments
 (0)