Fixed bug, where exception is raised where there shouldn't be raised one
This commit is contained in:
@@ -54,6 +54,7 @@ def run(
|
|||||||
env: dict[str, str] | None = None,
|
env: dict[str, str] | None = None,
|
||||||
cwd: Path = Path.cwd(),
|
cwd: Path = Path.cwd(),
|
||||||
log: Log = Log.STDERR,
|
log: Log = Log.STDERR,
|
||||||
|
check: bool = True,
|
||||||
) -> CmdOut:
|
) -> CmdOut:
|
||||||
# Start the subprocess
|
# Start the subprocess
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
@@ -70,14 +71,14 @@ def run(
|
|||||||
# Wait for the subprocess to finish
|
# Wait for the subprocess to finish
|
||||||
rc = process.wait()
|
rc = process.wait()
|
||||||
cmd_out = CmdOut(
|
cmd_out = CmdOut(
|
||||||
stdout_buf,
|
stdout=stdout_buf,
|
||||||
stderr_buf,
|
stderr=stderr_buf,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
command=shlex.join(cmd),
|
command=shlex.join(cmd),
|
||||||
returncode=process.returncode,
|
returncode=process.returncode,
|
||||||
)
|
)
|
||||||
|
|
||||||
if rc != 0:
|
if check and rc != 0:
|
||||||
raise ClanCmdError(cmd_out)
|
raise ClanCmdError(cmd_out)
|
||||||
|
|
||||||
return cmd_out
|
return cmd_out
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def _commit_file_to_git(repo_dir: Path, file_path: Path, commit_message: str) ->
|
|||||||
["nixpkgs#git"],
|
["nixpkgs#git"],
|
||||||
["git", "-C", str(repo_dir), "diff", "--cached", "--exit-code", str(file_path)],
|
["git", "-C", str(repo_dir), "diff", "--cached", "--exit-code", str(file_path)],
|
||||||
)
|
)
|
||||||
result = run(cmd, cwd=repo_dir)
|
result = run(cmd, check=False, cwd=repo_dir)
|
||||||
# if there is no diff, return
|
# if there is no diff, return
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user