Skip to content

Commit

Permalink
feat: Improve Error Handling for Cargo in Bootstrap Script (#4211)
Browse files Browse the repository at this point in the history
### Overview
This pull request introduces an improvement to the `bootstrap_native.sh`
script. It adds a preliminary check to verify whether Cargo, the Rust
package manager, is installed in the environment. This enhancement is
aimed at providing clearer error messages to developers setting up the
project.

### Changes Made
- Added a check in `bootstrap_native.sh` to determine if the `cargo`
command is available in the system.
- If Cargo is not found, the script now outputs a user-friendly error
message: `Cargo is not installed. Please install Cargo and the Rust
toolchain.`

### Motivation
During the setup process, particularly for new contributors or in
environments where Rust is not yet installed, the absence of Cargo could
lead to a cryptic error message. By explicitly checking for Cargo and
providing a clear error message, we make the setup process more
developer-friendly and intuitive.
  • Loading branch information
joaolago1113 authored Jan 30, 2024
1 parent 9fb6b09 commit 3a90849
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/bootstrap_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ else
export GIT_COMMIT=$(git rev-parse --verify HEAD)
fi

# Check if the 'cargo' command is available in the system
if ! command -v cargo > /dev/null; then
echo "Cargo is not installed. Please install Cargo and the Rust toolchain."
exit 1
fi

# Build native.
if [ -n "${DEBUG:-}" ]; then
cargo build
Expand Down

0 comments on commit 3a90849

Please sign in to comment.