summaryrefslogtreecommitdiff
path: root/cli/lockfile.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lockfile.rs')
-rw-r--r--cli/lockfile.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/lockfile.rs b/cli/lockfile.rs
index 6b553bd15..5df3b1213 100644
--- a/cli/lockfile.rs
+++ b/cli/lockfile.rs
@@ -12,6 +12,8 @@ use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
+use crate::tools::fmt::format_json;
+
#[derive(Debug, Clone)]
pub struct Lockfile {
write: bool,
@@ -42,13 +44,15 @@ impl Lockfile {
}
let j = json!(&self.map);
let s = serde_json::to_string_pretty(&j).unwrap();
+
+ let format_s = format_json(&s, &Default::default()).unwrap_or(s);
let mut f = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(&self.filename)?;
use std::io::Write;
- f.write_all(s.as_bytes())?;
+ f.write_all(format_s.as_bytes())?;
debug!("lockfile write {}", self.filename.display());
Ok(())
}