Skip to content

Commit 55f060a

Browse files
authored
emar: only use a response file if needed. NFC (#15668)
All the other command runners in `tools/building.py` use this pattern already. `test_emar_response_file` was updated to explicitly use a response file.
1 parent fe3d9db commit 55f060a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

tests/test_other.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from common import env_modify, no_mac, no_windows, requires_native_clang, with_env_modify
3737
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3838
from common import compiler_for, read_file, read_binary, EMBUILDER, require_v8, require_node
39-
from tools import shared, building, utils, deps_info
39+
from tools import shared, building, utils, deps_info, response_file
4040
import common
4141
import jsrun
4242
import clang_native
@@ -7770,7 +7770,8 @@ def test_emar_response_file(self):
77707770
create_file("file'2", ' ')
77717771
create_file("hyvää päivää", ' ')
77727772
create_file("snowman freezes covid ☃ 🦠", ' ')
7773-
building.emar('cr', 'libfoo.a', ("file'1", "file'2", "hyvää päivää", "snowman freezes covid ☃ 🦠"))
7773+
rsp = response_file.create_response_file(("file'1", "file'2", "hyvää päivää", "snowman freezes covid ☃ 🦠"), shared.TEMP_DIR)
7774+
building.emar('cr', 'libfoo.a', ['@' + rsp])
77747775

77757776
def test_archive_empty(self):
77767777
# This test added because we had an issue with the AUTO_ARCHIVE_INDEXES failing on empty

tools/building.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,9 @@ def parse_llvm_nm_symbols(output):
586586

587587
def emar(action, output_filename, filenames, stdout=None, stderr=None, env=None):
588588
try_delete(output_filename)
589-
response_filename = response_file.create_response_file(filenames, TEMP_DIR)
590-
cmd = [EMAR, action, output_filename] + ['@' + response_filename]
591-
try:
592-
run_process(cmd, stdout=stdout, stderr=stderr, env=env)
593-
finally:
594-
try_delete(response_filename)
589+
cmd = [EMAR, action, output_filename] + filenames
590+
cmd = get_command_with_possible_response_file(cmd)
591+
run_process(cmd, stdout=stdout, stderr=stderr, env=env)
595592

596593
if 'c' in action:
597594
assert os.path.exists(output_filename), 'emar could not create output file: ' + output_filename

0 commit comments

Comments
 (0)