1919logger = logging .getLogger (__name__ )
2020
2121
22+ class SubprocessRunError (Exception ):
23+ def __init__ (self , command , returncode , stdout , stderr ):
24+ self .command = command
25+ self .returncode = returncode
26+ self .stdout = stdout
27+ self .stderr = stderr
28+ self .message = (
29+ f"Errorcode { returncode } raised when running command '{ command } \n \n "
30+ f"stdout:\n { stdout } \n \n stderr:\n { stderr } "
31+ )
32+ super ().__init__ (self .message )
33+
34+
2235def run_command (
2336 command : str , check : bool = True , capture : bool = True , timeout : int = 600
2437) -> Optional [subprocess .CompletedProcess ]:
@@ -44,8 +57,8 @@ def run_command(
4457 if check and result .returncode != 0 :
4558 err_msg = (result .stderr or "" ).strip ()
4659 logger .error (f"[FAIL] Command failed: { command } \n Error: { err_msg } " )
47- raise subprocess . CalledProcessError (
48- result .returncode , args , output = result .stdout , stderr = result .stderr
60+ raise SubprocessRunError (
61+ result .returncode , command , result .stdout , result .stderr
4962 )
5063 return result
5164
@@ -198,14 +211,14 @@ def merge_source(
198211
199212 run_command (f"git -C { dest } fetch local { fetch } " )
200213
201- command = f"git -C { dest } merge --no-gpg-sign FETCH_HEAD"
214+ command = f"git -C { dest } merge --no-gpg-sign --no-edit FETCH_HEAD"
202215 result = run_command (command , check = False )
203216 if result .returncode :
204217 unmerged_files = get_unmerged (dest )
205218 if unmerged_files :
206219 handle_merge_conflicts (source , ref , dest , dest .name )
207220 else :
208- raise subprocess . CalledProcessError (
221+ raise SubprocessRunError (
209222 result .returncode , command , result .stdout , result .stderr
210223 )
211224
0 commit comments