Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver-rs)(install): _install-local-rust.sh sources ~/.cargo/env when cargo isn't on PATH (#1713)

Francesco Bonacci83d4916270a9
diff --git a/libs/cua-driver/scripts/_install-local-rust.sh b/libs/cua-driver/scripts/_install-local-rust.sh
index e62ebae590..b2d6dd2f2d 100755
--- a/libs/cua-driver/scripts/_install-local-rust.sh
+++ b/libs/cua-driver/scripts/_install-local-rust.sh
@@ -156,9 +156,28 @@ echo ""
# --- Prerequisites ------------------------------------------------------
+if ! command -v cargo >/dev/null 2>&1; then
+ # Common rustup default install at $HOME/.cargo/bin/cargo — source the
+ # rustup-shipped env script if present so cargo + rustc + the active
+ # toolchain shims all land on PATH for the rest of this script. This
+ # matters because rustup-init writes the PATH-prepending line into the
+ # user's shell rc, which only takes effect in NEW interactive shells —
+ # a fresh post-rustup invocation of `./install-local.sh` in the same
+ # shell as the rustup install would otherwise fail here even though
+ # cargo is on disk.
+ if [ -f "$HOME/.cargo/env" ]; then
+ # shellcheck disable=SC1091
+ . "$HOME/.cargo/env"
+ elif [ -x "$HOME/.cargo/bin/cargo" ]; then
+ # Older rustup installs (or non-rustup Cargo installs) may lack
+ # the env script — directly prepend the canonical bin dir.
+ export PATH="$HOME/.cargo/bin:$PATH"
+ fi
+fi
if ! command -v cargo >/dev/null 2>&1; then
echo "${RED}Error: cargo not found on PATH.${NORMAL}"
echo "Install Rust via rustup: https://rustup.rs/"
+ echo "After install, either open a new shell or run: . \$HOME/.cargo/env"
exit 1
fi