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,
|
||||
cwd: Path = Path.cwd(),
|
||||
log: Log = Log.STDERR,
|
||||
check: bool = True,
|
||||
) -> CmdOut:
|
||||
# Start the subprocess
|
||||
process = subprocess.Popen(
|
||||
@@ -70,14 +71,14 @@ def run(
|
||||
# Wait for the subprocess to finish
|
||||
rc = process.wait()
|
||||
cmd_out = CmdOut(
|
||||
stdout_buf,
|
||||
stderr_buf,
|
||||
stdout=stdout_buf,
|
||||
stderr=stderr_buf,
|
||||
cwd=cwd,
|
||||
command=shlex.join(cmd),
|
||||
returncode=process.returncode,
|
||||
)
|
||||
|
||||
if rc != 0:
|
||||
if check and rc != 0:
|
||||
raise ClanCmdError(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"],
|
||||
["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 result.returncode == 0:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user