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
Next Next commit
don't run .bashrc for any commands fed from .hcbuild
  • Loading branch information
pdaoust committed Feb 12, 2020
commit 5ba5af624dd51bab93b30e3c231c073f437fd16a
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