Skip to content

Commit 810801d

Browse files
committed
Avoid changing working directory EMCC_BATCH_BUILD is unset. NFC
When not using `EMCC_BATCH_BUILD` the working directory does not matter.
1 parent c9fc5f3 commit 810801d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tools/system_libs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ def clean_env():
102102
return safe_env
103103

104104

105-
def run_build_commands(commands, num_inputs, build_dir=None):
105+
def run_build_commands(commands, num_inputs, cwd=None):
106106
# Before running a set of build commands make sure the common sysroot
107107
# headers are installed. This prevents each sub-process from attempting
108108
# to setup the sysroot itself.
109109
ensure_sysroot()
110110
start_time = time()
111-
shared.run_multiple_processes(commands, env=clean_env(), cwd=build_dir)
111+
shared.run_multiple_processes(commands, env=clean_env(), cwd=cwd)
112112
logger.info(f'compiled {num_inputs} inputs in {time() - start_time:.2f}s')
113113

114114

@@ -535,7 +535,9 @@ def build_objects(self, build_dir):
535535
objects.add(o)
536536
objects_lowercase.add(o.lower())
537537

538+
cwd = None
538539
if batch_inputs:
540+
cwd = build_dir
539541
# Choose a chunk size that is large enough to avoid too many subprocesses
540542
# but not too large to avoid task starvation.
541543
# For now the heuristic is to split inputs by 2x number of cores.
@@ -547,7 +549,7 @@ def build_objects(self, build_dir):
547549
chunk_srcs = srcs[i:i + chunk_size]
548550
commands.append(building.get_command_with_possible_response_file(cmd + chunk_srcs))
549551

550-
run_build_commands(commands, num_inputs=len(objects), build_dir=build_dir)
552+
run_build_commands(commands, num_inputs=len(objects), cwd=cwd)
551553
return objects
552554

553555
def customize_build_cmd(self, cmd, _filename):

0 commit comments

Comments
 (0)