diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 169f7b585..52d98cfea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -179,6 +179,13 @@ jobs: pkgx -Q node git | grep -q nodejs.org ! pkgx -Q git-scm.org@99999 + - name: test PKGX_NO_INSTALL + run: | + rm -r ~/.pkgx/stedolan.github.io/jq || true + ! PKGX_NO_INSTALL=1 pkgx jq --version + pkgx jq --version + PKGX_NO_INSTALL=1 pkgx jq --version + - run: if [ $(find ~/.pkgx -name .tmp\* -type d | wc -l) -gt 0 ]; then exit 1; fi diff --git a/Cargo.lock b/Cargo.lock index 7a7101052..628be5d3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1059,7 +1059,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "pkgx" -version = "2.8.0" +version = "2.9.0" dependencies = [ "console", "indicatif", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 085f1d976..4c24de302 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -3,7 +3,7 @@ name = "pkgx" description = "Run anything" authors = ["Max Howell ", "Jacob Heider "] license = "Apache-2.0" -version = "2.8.0" +version = "2.9.0" edition = "2021" repository = "https://github.com/pkgxdev/pkgx" diff --git a/crates/cli/src/resolve.rs b/crates/cli/src/resolve.rs index 38246c25a..dbac0e3bd 100644 --- a/crates/cli/src/resolve.rs +++ b/crates/cli/src/resolve.rs @@ -1,3 +1,5 @@ +use std::env; + use libpkgx::{ config::Config, hydrate::hydrate, @@ -84,6 +86,9 @@ pub async fn resolve( let mut installations = resolution.installed; if !resolution.pending.is_empty() { + if env::var("PKGX_NO_INSTALL").is_ok() { + return Err("PKGX_NO_INSTALL is set, refusing to install pending packages")?; + } let installed = install_multi(&resolution.pending, config, spinner.arc()).await?; installations.extend(installed); }