Skip to content

Commit

Permalink
Merge branch 'tempdir_root_env'
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Apr 22, 2022
2 parents f7a5cd6 + 0c47bd7 commit 31e88fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ impl BitcoinD {

/// Launch the bitcoind process from the given `exe` executable with given [Conf] param
pub fn with_conf<S: AsRef<OsStr>>(exe: S, conf: &Conf) -> Result<BitcoinD, Error> {
let work_dir = match (&conf.tmpdir, &conf.staticdir) {
let tmpdir = conf
.tmpdir
.clone()
.or_else(|| env::var("TEMPDIR_ROOT").map(PathBuf::from).ok());
let work_dir = match (&tmpdir, &conf.staticdir) {
(Some(_), Some(_)) => return Err(Error::BothDirsSpecified),
(Some(tmpdir), None) => DataDir::Temporary(TempDir::new_in(tmpdir)?),
(None, Some(workdir)) => {
Expand Down

0 comments on commit 31e88fd

Please sign in to comment.