@@ -84,7 +84,6 @@ def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
8484def call_subprocess (
8585 cmd , # type: Union[List[str], CommandArgs]
8686 cwd = None , # type: Optional[str]
87- on_returncode = 'raise' , # type: str
8887 extra_environ = None , # type: Optional[Mapping[str, Any]]
8988 extra_ok_returncodes = None , # type: Optional[Iterable[int]]
9089 log_failed_cmd = True # type: Optional[bool]
@@ -150,32 +149,21 @@ def call_subprocess(
150149 proc .returncode and proc .returncode not in extra_ok_returncodes
151150 )
152151 if proc_had_error :
153- if on_returncode == 'raise' :
154- if not showing_subprocess and log_failed_cmd :
155- # Then the subprocess streams haven't been logged to the
156- # console yet.
157- msg = make_subprocess_output_error (
158- cmd_args = cmd ,
159- cwd = cwd ,
160- lines = all_output ,
161- exit_status = proc .returncode ,
162- )
163- subprocess_logger .error (msg )
164- exc_msg = (
165- 'Command errored out with exit status {}: {} '
166- 'Check the logs for full command output.'
167- ).format (proc .returncode , command_desc )
168- raise SubProcessError (exc_msg )
169- elif on_returncode == 'warn' :
170- subprocess_logger .warning (
171- 'Command "{}" had error code {} in {}' .format (
172- command_desc , proc .returncode , cwd )
152+ if not showing_subprocess and log_failed_cmd :
153+ # Then the subprocess streams haven't been logged to the
154+ # console yet.
155+ msg = make_subprocess_output_error (
156+ cmd_args = cmd ,
157+ cwd = cwd ,
158+ lines = all_output ,
159+ exit_status = proc .returncode ,
173160 )
174- elif on_returncode == 'ignore' :
175- pass
176- else :
177- raise ValueError ('Invalid value: on_returncode={!r}' .format (
178- on_returncode ))
161+ subprocess_logger .error (msg )
162+ exc_msg = (
163+ 'Command errored out with exit status {}: {} '
164+ 'Check the logs for full command output.'
165+ ).format (proc .returncode , command_desc )
166+ raise SubProcessError (exc_msg )
179167 return '' .join (all_output )
180168
181169
@@ -768,7 +756,6 @@ def run_command(
768756 cls ,
769757 cmd , # type: Union[List[str], CommandArgs]
770758 cwd = None , # type: Optional[str]
771- on_returncode = 'raise' , # type: str
772759 extra_environ = None , # type: Optional[Mapping[str, Any]]
773760 extra_ok_returncodes = None , # type: Optional[Iterable[int]]
774761 log_failed_cmd = True # type: bool
@@ -782,7 +769,6 @@ def run_command(
782769 cmd = make_command (cls .name , * cmd )
783770 try :
784771 return call_subprocess (cmd , cwd ,
785- on_returncode = on_returncode ,
786772 extra_environ = extra_environ ,
787773 extra_ok_returncodes = extra_ok_returncodes ,
788774 log_failed_cmd = log_failed_cmd )
0 commit comments