Skip to content

Commit 2930a6e

Browse files
lock the cargo package cache when building
1 parent fa048c6 commit 2930a6e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/utils/build_doc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub fn build_doc(name: &str, vers: Option<&str>, target: Option<&str>) -> Result
4040
let source_cfg_map = try!(SourceConfigMap::new(&config));
4141
let mut source = try!(source_cfg_map.load(source_id, &HashSet::new()));
4242

43+
let _lock = try!(config.acquire_package_cache_lock());
44+
4345
// update crates.io-index registry
4446
try!(source.update());
4547

@@ -164,6 +166,8 @@ pub fn get_package(name: &str, vers: Option<&str>) -> CargoResult<Package> {
164166
let source_map = try!(SourceConfigMap::new(&config));
165167
let mut source = try!(source_map.load(source_id, &HashSet::new()));
166168

169+
let _lock = try!(config.acquire_package_cache_lock());
170+
167171
try!(source.update());
168172

169173
let dep = try!(Dependency::parse_no_deprecated(name, vers, source_id));
@@ -189,6 +193,8 @@ pub fn update_sources() -> CargoResult<()> {
189193
let config = try!(Config::default());
190194
let source_id = try!(SourceId::crates_io(&config));
191195

196+
let _lock = try!(config.acquire_package_cache_lock());
197+
192198
let source_map = try!(SourceConfigMap::new(&config));
193199
let mut source = try!(source_map.load(source_id, &HashSet::new()));
194200

0 commit comments

Comments
 (0)