Skip to content

Commit

Permalink
drop shell
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed Dec 21, 2023
1 parent 6ae7a68 commit 06ec203
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions worker/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,15 +694,20 @@ def setup_engine(
# skip temporary the profiled build for apple silicon, see
# https://stackoverflow.com/questions/71580631/how-can-i-get-code-coverage-with-clang-13-0-1-on-mac
make_cmd = "build" if arch == "apple-silicon" else "profile-build"
cmd = "make -j {} {} ARCH={} COMP={}".format(concurrency, make_cmd, arch, comp)
cmd = [
"make",
f"-j{concurrency}",
f"{make_cmd}",
f"ARCH={arch}",
f"COMP={comp}",
]

# append -DNNUE_EMBEDDING_OFF to existing CXXFLAGS environment variable, if any
cxx = os.environ.get("CXXFLAGS", "") + " -DNNUE_EMBEDDING_OFF"
env = dict(os.environ, CXXFLAGS=cxx.strip())

with subprocess.Popen(
cmd,
shell=True,
env=env,
start_new_session=False if IS_WINDOWS else True,
stdout=subprocess.PIPE,
Expand All @@ -725,17 +730,11 @@ def setup_engine(
if p.returncode:
raise WorkerException("Executing {} failed. Error: {}".format(cmd, errors))

# TODO: 'make strip' works fine with the new Makefile,
# 'try' should be safely dropped in the future
try:
subprocess.run(
"make strip COMP={}".format(comp),
stderr=subprocess.DEVNULL,
shell=True,
check=True,
)
except Exception as e:
print("Exception stripping binary:\n", e, sep="", file=sys.stderr)
subprocess.run(
["make", "strip", f"COMP={comp}"],
stderr=subprocess.DEVNULL,
check=True,
)

# We called setup_engine() because the engine was not cached.
# Only another worker running in the same folder can have built the engine.
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 226, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "AlzBfLw8QpQx5mQmOXedSHxcBG5v+Jw5pyW3gTeUsdDzi+23Jhf7T8gcIUGQFu0A", "games.py": "ef8FgL7dNT3ALVmuWQA/WoLu6y5khfJR5Ji2KOaLPu4oAnEJdWt8u1hLlObie47+"}
{"__version": 226, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "AlzBfLw8QpQx5mQmOXedSHxcBG5v+Jw5pyW3gTeUsdDzi+23Jhf7T8gcIUGQFu0A", "games.py": "fAhbAhMvxUC28FEcu9N8wpHmsHNCm4GeM+WCwcR08y9ecTHbM8gT7ieGFc4QPmG7"}

0 comments on commit 06ec203

Please sign in to comment.