Skip to content

Commit

Permalink
Print status messages when pulling quickstart image (#1546)
Browse files Browse the repository at this point in the history
* Print status messages when pulling quickstart image

* Logging when there is no internet connection

---------

Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com>
  • Loading branch information
elizabethengelman and leighmcculloch authored Aug 16, 2024
1 parent 368f666 commit 5254c13
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
39 changes: 28 additions & 11 deletions cmd/soroban-cli/src/commands/network/container/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,34 @@ impl Runner {
let docker = self.args.container_args.connect_to_docker().await?;

let image = self.get_image_name();
docker
.create_image(
Some(CreateImageOptions {
from_image: image.clone(),
..Default::default()
}),
None,
None,
)
.try_collect::<Vec<_>>()
.await?;
let mut stream = docker.create_image(
Some(CreateImageOptions {
from_image: image.clone(),
..Default::default()
}),
None,
None,
);

while let Some(result) = stream.try_next().await.transpose() {
if let Ok(item) = result {
if let Some(status) = item.status {
if status.contains("Pulling from")
|| status.contains("Digest")
|| status.contains("Status")
{
self.print.infoln(status);
}
}
} else {
self.print
.warnln(format!("Failed to fetch image: {image}."));
self.print.warnln(
"Attempting to start local quickstart image. The image may be out-of-date.",
);
break;
}
}

let config = Config {
image: Some(image),
Expand Down
1 change: 1 addition & 0 deletions cmd/soroban-cli/src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ create_print_functions!(info, infoln, "ℹ️");
create_print_functions!(link, linkln, "🔗");
create_print_functions!(save, saveln, "💾");
create_print_functions!(search, searchln, "🔎");
create_print_functions!(warn, warnln, "⚠️");

0 comments on commit 5254c13

Please sign in to comment.