Skip to content

Commit e675cbf

Browse files
committed
Adapt warning API for usage in install
The `warning` helper API just became unused by the previous commit; make it used in another place it should have been. Signed-off-by: Colin Walters <[email protected]>
1 parent 8702bcc commit e675cbf

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/src/install.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,9 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
10181018
.with_context(|| format!("Querying {}", &block_opts.device))?;
10191019
if opts.via_loopback {
10201020
if !opts.config_opts.generic_image {
1021-
eprintln!("Automatically enabling --generic-image when installing via loopback");
1022-
std::thread::sleep(std::time::Duration::from_secs(2));
1021+
crate::utils::medium_visibility_warning(
1022+
"Automatically enabling --generic-image when installing via loopback",
1023+
);
10231024
opts.config_opts.generic_image = true;
10241025
}
10251026
if !target_blockdev_meta.file_type().is_file() {

lib/src/utils.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,16 @@ pub(crate) fn sigpolicy_from_opts(
6767
}
6868
}
6969

70-
/// Output a warning message
71-
pub(crate) fn warning(s: &str) {
70+
/// Output a warning message that we want to be quite visible.
71+
/// The process (thread) execution will be delayed for a short time.
72+
pub(crate) fn medium_visibility_warning(s: &str) {
7273
anstream::eprintln!(
7374
"{}{s}{}",
7475
anstyle::AnsiColor::Red.render_fg(),
7576
anstyle::Reset.render()
7677
);
78+
// When warning, add a sleep to ensure it's seen
79+
std::thread::sleep(std::time::Duration::from_secs(1));
7780
}
7881

7982
/// Given a possibly tagged image like quay.io/foo/bar:latest and a digest 0ab32..., return

0 commit comments

Comments
 (0)