Exit with errorlevel set

This commit is contained in:
Fierelier 2024-01-19 21:47:52 +01:00
parent b751765b0f
commit 5ea0a6a766
1 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ def runReg(cmd,check = True):
else: else:
cmdStr = " ".join(cmd) cmdStr = " ".join(cmd)
cmdProc = subprocess.Popen(["cmd.exe"],stdin=subprocess.PIPE,stdout=subprocess.DEVNULL) cmdProc = subprocess.Popen(["cmd.exe"],stdin=subprocess.PIPE,stdout=subprocess.DEVNULL)
cmdProc.stdin.write((cmdStr + "\nexit\n").encode("utf-8")) cmdProc.stdin.write((cmdStr + "\nexit %errorlevel%\n").encode("utf-8"))
cmdProc.stdin.flush() cmdProc.stdin.flush()
rtn = cmdProc.wait() rtn = cmdProc.wait()
if rtn != 0: raise Exception if rtn != 0: raise Exception
@ -265,4 +265,4 @@ def applyRegmap(rp):
for path in target["regmap"]: for path in target["regmap"]:
if rp.startswith(path): if rp.startswith(path):
return rp.replace(path,target["regmap"][path],1) return rp.replace(path,target["regmap"][path],1)
return rp return rp