Skip to content

Commit

Permalink
fix error catch
Browse files Browse the repository at this point in the history
  • Loading branch information
CSY-ModelCloud committed Jan 10, 2025
1 parent a505143 commit 0dd4e15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion device_smi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _run(args, line_start: Optional[str] = None, seperator: str=None): # -> str
)

if result.returncode != 0 or result.stderr.strip() != "":
raise RuntimeError(result.stderr)
raise RuntimeError(result.stderr if result.stderr else result.stdout if result.stdout else "unknown error")

result = result.stdout.strip()
result = re.sub(r'\n+', '\n', result) # remove consecutive \n
Expand Down

0 comments on commit 0dd4e15

Please sign in to comment.