Use new permissions when installing directly from a hart
This only applies to `hab pkg install /path/to/a/package.hart` cases.
@@ -34,6 +34,8 @@ use crate::{api_client::{self,
UIWriter},
FeatureFlag};
use glob;
+#[cfg(not(windows))]
+use habitat_core::fs::DEFAULT_CACHED_ARTIFACT_PERMISSIONS;
use habitat_core::{self,
crypto::{artifact,
keys::parse_name_with_rev,
@@ -931,7 +933,10 @@ impl<'a> InstallTask<'a> {
debug!("copying artifact to cache, artifact_path={}, cached_path={}",
artifact_path.display(),
cache_path.display());
- let w = AtomicWriter::new(&cache_path)?;
+ let mut w = AtomicWriter::new(&cache_path)?;
+ if cfg!(not(target_os = "windows")) {
+ w.with_permissions(DEFAULT_CACHED_ARTIFACT_PERMISSIONS);
+ }
w.with_writer(|mut w| {
let mut f = File::open(artifact_path)?;
io::copy(&mut f, &mut w)
