Skip to content

Commit 16bd807

Browse files
committed
notifications: log directly after failing to determine memory limit
1 parent f4497dc commit 16bd807

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/dist/component/package.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
1010

1111
use anyhow::{Context, Result, anyhow, bail};
1212
use tar::EntryType;
13-
use tracing::warn;
13+
use tracing::{error, warn};
1414

1515
use crate::diskio::{CompletedIo, Executor, FileBuffer, IO_CHUNK_SIZE, Item, Kind, get_executor};
1616
use crate::dist::component::components::*;
@@ -290,10 +290,8 @@ fn unpack_without_first_dir<R: Read>(
290290
let entries = archive.entries()?;
291291
let effective_max_ram = match effective_limits::memory_limit() {
292292
Ok(ram) => Some(ram as usize),
293-
Err(e) => {
294-
if let Some(h) = cx.notify_handler {
295-
h(Notification::Error(e.to_string()))
296-
}
293+
Err(error) => {
294+
error!("can't determine memory limit: {error}");
297295
None
298296
}
299297
};

src/notifications.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub(crate) enum Notification<'a> {
4141
/// member, but the notification callback is already narrowed to
4242
/// utils::notifications by the time tar unpacking is called.
4343
SetDefaultBufferSize(usize),
44-
Error(String),
4544
SetAutoInstall(&'a str),
4645
SetDefaultToolchain(Option<&'a ToolchainName>),
4746
SetOverrideToolchain(&'a Path, &'a str),
@@ -91,7 +90,6 @@ impl Notification<'_> {
9190
| DownloadFinished(_)
9291
| DownloadFailed(_)
9392
| ResumingPartialDownload => NotificationLevel::Debug,
94-
Error(_) => NotificationLevel::Error,
9593
ToolchainDirectory(_)
9694
| LookingForToolchain(_)
9795
| InstallingToolchain(_)
@@ -189,7 +187,6 @@ impl Display for Notification<'_> {
189187
write!(f, "Force-skipping unavailable component '{component}'")
190188
}
191189
RetryingDownload(url) => write!(f, "retrying download for '{url}'"),
192-
Error(e) => write!(f, "error: '{e}'"),
193190
SetDefaultBufferSize(size) => write!(
194191
f,
195192
"using up to {} of RAM to unpack components",

0 commit comments

Comments
 (0)