File tree 3 files changed +11
-14
lines changed
3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ def run():
332
332
return 1
333
333
334
334
# read response files very early on
335
- substitute_response_files (sys .argv )
335
+ sys . argv = substitute_response_files (sys .argv )
336
336
337
337
if len (sys .argv ) == 1 or '--help' in sys .argv :
338
338
# Documentation for emcc and its options must be updated in:
Original file line number Diff line number Diff line change @@ -2267,7 +2267,7 @@ def ensure_struct_info():
2267
2267
2268
2268
2269
2269
def _main (args ):
2270
- substitute_response_files (args )
2270
+ args = substitute_response_files (args )
2271
2271
2272
2272
parser = argparse .ArgumentParser (
2273
2273
usage = '%(prog)s [-h] [-H HEADERS] [-o OUTFILE] [-c COMPILER_ENGINE] [-s FOO=BAR]* infile' ,
Original file line number Diff line number Diff line change @@ -44,9 +44,8 @@ def read_response_file(response_filename):
44
44
if not os .path .exists (response_filename ):
45
45
raise Exception ("Response file '%s' not found!" % response_filename )
46
46
47
- response_fd = open (response_filename , 'r' )
48
- args = response_fd .read ()
49
- response_fd .close ()
47
+ with open (response_filename ) as f :
48
+ args = f .read ()
50
49
args = shlex .split (args )
51
50
52
51
if DEBUG :
@@ -57,12 +56,10 @@ def read_response_file(response_filename):
57
56
58
57
def substitute_response_files (args ):
59
58
"""Substitute any response files found in args with their contents."""
60
- found = True
61
- while found :
62
- found = False
63
- for index in range (len (args )):
64
- if args [index ].startswith ('@' ):
65
- found = True
66
- new_args = read_response_file (args [index ])
67
- args [index :index + 1 ] = new_args
68
- break
59
+ new_args = []
60
+ for arg in args :
61
+ if arg .startswith ('@' ):
62
+ new_args += read_response_file (arg )
63
+ else :
64
+ new_args .append (arg )
65
+ return new_args
You can’t perform that action at this time.
0 commit comments