Set non-zero exit codes for custom component build and install commands when failures occur (#9088)

* Exit codes

* add changeset

* Fix text

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2024-08-12 12:09:52 -07:00 committed by GitHub
parent 508ac84bc2
commit 96f8ffa5ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:Set non-zero exit codes for custom component build and install commands when failures occur

View File

@ -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!")
@ -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(

View File

@ -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!")
@ -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!")