@@ -211,8 +211,7 @@ def read_response_file(file_path):
211211 # "Make an iterator out of shlex.shlex.get_token, then consume items
212212 # until it returns None." (Then eagerly convert the result to a list so
213213 # that we can close the file.)
214- return list (iter (shlex .shlex (files , file_path , posix = True ).get_token ,
215- None ))
214+ return [line .strip () for line in files if line .strip ()]
216215
217216
218217def expand_response_files (files ):
@@ -686,13 +685,18 @@ def run():
686685 command_args = expand_response_files (sys .argv [dashes + 1 :])
687686 command_args [0 ] = os .path .normpath (command_args [0 ])
688687
689- command = subprocess .Popen (
690- command_args ,
691- stderr = subprocess .STDOUT ,
692- stdout = subprocess .PIPE ,
693- universal_newlines = True ,
694- encoding = 'UTF-8'
695- )
688+ try :
689+ command = subprocess .Popen (
690+ command_args ,
691+ stderr = subprocess .STDOUT ,
692+ stdout = subprocess .PIPE ,
693+ universal_newlines = True ,
694+ encoding = 'UTF-8'
695+ )
696+ except Exception as e :
697+ sys .stderr .write (f"Error executing command: { e } \n " )
698+ sys .stderr .write (f"Command: { ' ' .join (shlex .quote (arg ) for arg in command_args )} \n " )
699+ sys .exit (1 )
696700
697701 sources = '(?P<file>' + '|' .join (re .escape (s ) for s in sources ) + ')'
698702
@@ -731,7 +735,12 @@ def run():
731735 m .group ('tail' ))
732736 sys .stdout .write (output )
733737
734- sys .exit (command .wait ())
738+ exit_code = command .wait ()
739+ if exit_code != 0 :
740+ sys .stderr .write (f"Command failed with exit code { exit_code } \n " )
741+ sys .stderr .write (f"Command: { ' ' .join (shlex .quote (arg ) for arg in command_args )} \n " )
742+
743+ sys .exit (exit_code )
735744
736745
737746if __name__ == '__main__' :
0 commit comments