Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

don't run .bashrc for any commands fed from .hcbuild #2108

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG-UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Fixed

- `.bashrc` files that echo to STDOUT should no longer cause `hc package` to fail. [PR#2108](https://github.com/holochain/holochain-rust/pull/2108)

### Security

7 changes: 6 additions & 1 deletion crates/cli/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ pub fn run_cmd(base_path: &PathBuf, bin: String, args: &[&str]) -> DefaultResult
// e.g. we assume `cargo`, `wasm-gc`, `wasm-opt`, `wasm2wat`, `wat2wasm` all exist in the
// default template (which we can't assume outside nix-shell in a portable way).
//
// Note the use of --norc. This is to prevent the shell from loading up its usual startup
// script, which may echo things to STDOUT. The reason this matters is that some of the
// commands in a .hcbuild file (which are fed to this function) capture from STDOUT and do
// something meaningful with the value. Do we really want a MOTD in our build artifact path?
//
// @TODO - does it make more sense to push "execute arbitrary bash" style features down to the
// `nix-shell` layer where we have a better toolkit to handle environments/dependencies?
// e.g. @see `hn-release-cut` from holonix that implements conventions/hooks to standardise
// bash processes in an extensible way
let status = Command::new("bash")
.args(&["-c", &command_string])
.args(&["--norc", "-c", &command_string])
.current_dir(base_path)
.status()?;

Expand Down