Skip to content

Commit

Permalink
util.py: capture_output is a more concise and readable way to captu…
Browse files Browse the repository at this point in the history
…re both `stdout` and `stderr`.
  • Loading branch information
ProjectSynchro committed Sep 22, 2024
1 parent 3b9ed4d commit 17a428e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,11 @@ def patch_libcuda() -> bool:
log.warn('ldconfig not found in PATH.')
return False

# Use subprocess.run with explicit encoding handling
# Use subprocess.run with capture_output and explicit encoding handling
try:
result = subprocess.run(
[ldconfig_path, '-p'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
check=True
)
# Decode the output using utf-8 with fallback to locale preferred encoding
Expand Down

0 comments on commit 17a428e

Please sign in to comment.