Skip to content

Commit 2370c61

Browse files
authored
Merge pull request #1224 from pkgxdev/fix-1222
add PKGX_NO_INSTALL
2 parents 85aa46b + 66f96fb commit 2370c61

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ jobs:
179179
pkgx -Q node git | grep -q nodejs.org
180180
! pkgx -Q git-scm.org@99999
181181
182+
- name: test PKGX_NO_INSTALL
183+
run: |
184+
rm -r ~/.pkgx/stedolan.github.io/jq || true
185+
! PKGX_NO_INSTALL=1 pkgx jq --version
186+
pkgx jq --version
187+
PKGX_NO_INSTALL=1 pkgx jq --version
188+
182189
- run: if [ $(find ~/.pkgx -name .tmp\* -type d | wc -l) -gt 0 ]; then
183190
exit 1;
184191
fi

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "pkgx"
33
description = "Run anything"
44
authors = ["Max Howell <mxcl@me.com>", "Jacob Heider <jacob@pkgx.dev>"]
55
license = "Apache-2.0"
6-
version = "2.8.0"
6+
version = "2.9.0"
77
edition = "2021"
88
repository = "https://github.com/pkgxdev/pkgx"
99

crates/cli/src/resolve.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::env;
2+
13
use libpkgx::{
24
config::Config,
35
hydrate::hydrate,
@@ -84,6 +86,9 @@ pub async fn resolve(
8486

8587
let mut installations = resolution.installed;
8688
if !resolution.pending.is_empty() {
89+
if env::var("PKGX_NO_INSTALL").is_ok() {
90+
return Err("PKGX_NO_INSTALL is set, refusing to install pending packages")?;
91+
}
8792
let installed = install_multi(&resolution.pending, config, spinner.arc()).await?;
8893
installations.extend(installed);
8994
}

0 commit comments

Comments
 (0)