tools/progress: Add finish and abort functions
We have external progress handlers which would like to implement these
functions, in order to update the screen upon completion or error.
Change-Id: I2df4654d5e2092407a83d2c8bbb020dcce84ac50
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/tools/lpc.cpp b/tools/lpc.cpp
index cd48844..d552b6a 100644
--- a/tools/lpc.cpp
+++ b/tools/lpc.cpp
@@ -117,6 +117,7 @@
auto readBuffer = std::make_unique<std::uint8_t[]>(host_lpc_buf.length);
if (nullptr == readBuffer)
{
+ progress->abort();
sys->close(inputFd);
std::fprintf(stderr, "Unable to allocate memory for read buffer.\n");
return false;
@@ -156,10 +157,12 @@
}
catch (const ipmiblob::BlobException& b)
{
+ progress->abort();
sys->close(inputFd);
return false;
}
+ progress->finish();
sys->close(inputFd);
return true;
}