Skip to content

Commit

Permalink
Set non-zero exit codes for custom component build and install comman…
Browse files Browse the repository at this point in the history
…ds when failures occur (#9088)

* Exit codes

* add changeset

* Fix text

---------

Co-authored-by: gradio-pr-bot <[email protected]>
  • Loading branch information
freddyaboulton and gradio-pr-bot authored Aug 12, 2024
1 parent 508ac84 commit 96f8ffa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/every-parks-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Set non-zero exit codes for custom component build and install commands when failures occur
3 changes: 2 additions & 1 deletion gradio/cli/commands/components/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _build(
live.update(":red_square: Build failed!")
live.update(pipe.stderr)
live.update(pipe.stdout)
return
raise SystemExit("Frontend build failed")
else:
live.update(":white_check_mark: Build succeeded!")

Expand All @@ -172,6 +172,7 @@ def _build(
if pipe.returncode != 0:
live.update(":red_square: Build failed!")
live.update(pipe.stderr)
raise SystemExit("Python build failed")
else:
live.update(":white_check_mark: Build succeeded!")
live.update(
Expand Down
3 changes: 3 additions & 0 deletions gradio/cli/commands/components/install_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def _install_command(
if pipe.returncode != 0:
live.update(":red_square: Python installation [bold][red]failed[/][/]")
live.update(pipe.stderr)
raise SystemExit("Python installation failed")

else:
live.update(":white_check_mark: Python install succeeded!")

Expand All @@ -85,6 +87,7 @@ def _install_command(
live.update(":red_square: NPM install [bold][red]failed[/][/]")
live.update(pipe.stdout)
live.update(pipe.stderr)
raise SystemExit("NPM install failed")
else:
live.update(":white_check_mark: NPM install succeeded!")

Expand Down

0 comments on commit 96f8ffa

Please sign in to comment.