Skip to content

Commit c0e2ea6

Browse files
committed
dist: Make use of effective-limits be reliant on non-bsd
Signed-off-by: Daniel Silverstone <[email protected]>
1 parent 5a75a72 commit c0e2ea6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/dist/component/package.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,21 @@ fn unpack_without_first_dir<'a, R: Read>(
298298
.entries()
299299
.chain_err(|| ErrorKind::ExtractingPackage)?;
300300
const MAX_FILE_SIZE: u64 = 220_000_000;
301-
let effective_max_ram = match effective_limits::memory_limit() {
302-
Ok(ram) => Some(ram as usize),
303-
Err(e) => {
304-
if let Some(h) = notify_handler {
305-
h(Notification::Error(e.to_string()))
301+
let effective_max_ram = {
302+
cfg_if::cfg_if! {
303+
if #[cfg(not(any(target_os="freebsd", target_os="netbsd")))] {
304+
match effective_limits::memory_limit() {
305+
Ok(ram) => Some(ram as usize),
306+
Err(e) => {
307+
if let Some(h) = notify_handler {
308+
h(Notification::Error(e.to_string()))
309+
}
310+
None
311+
}
312+
}
313+
} else {
314+
None
306315
}
307-
None
308316
}
309317
};
310318
let mut budget = MemoryBudget::new(MAX_FILE_SIZE as usize, effective_max_ram, notify_handler);

0 commit comments

Comments
 (0)