-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error messages for subprocess calls (#104)
- Loading branch information
1 parent
6e9fab9
commit 60c7681
Showing
4 changed files
with
34 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import subprocess | ||
import sys | ||
|
||
from usethis._console import console | ||
|
||
|
||
def call_subprocess(args: list[str]) -> None: | ||
try: | ||
subprocess.run( | ||
args, | ||
check=True, | ||
capture_output=True, | ||
) | ||
except subprocess.CalledProcessError as e: | ||
msg = e.stderr.decode() | ||
console.print(f"✗ Failed to run uv subprocess:\n{msg}", style="red") | ||
sys.exit(e.returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters