diff options
| author | Dan Engelbrecht <[email protected]> | 2025-02-25 15:48:43 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-02-25 15:48:43 +0100 |
| commit | 5bc5b0dd59c0f02afe553e5074dfe57951b19044 (patch) | |
| tree | 625d46a9ef656cd6dd5f2879182f686b0299f44b /src/zen/zen.cpp | |
| parent | 5.5.18 (diff) | |
| download | archived-zen-5bc5b0dd59c0f02afe553e5074dfe57951b19044.tar.xz archived-zen-5bc5b0dd59c0f02afe553e5074dfe57951b19044.zip | |
improvements and infrastructure for upcoming builds api command line (#284)
* add modification tick to filesystem traversal
* add ShowDetails option to ProgressBar
* log callstack if we terminate process
* handle chunking if MaxSize > 1MB
* BasicFile write helpers and WriteToTempFile simplifications
* bugfix for CompositeBuffer::IterateRange when using DecompressToComposite for actually comrpessed data
revert of earlier optimization
* faster compress/decompress for large disk-based files
* enable progress feedback in IoHash::HashBuffer
* add payload validation in HttpClient::Get
* fix range requests (range is including end byte)
* remove BuildPartId for blob/block related operations in builds api
Diffstat (limited to 'src/zen/zen.cpp')
| -rw-r--r-- | src/zen/zen.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp index fd58b024a..872ea8941 100644 --- a/src/zen/zen.cpp +++ b/src/zen/zen.cpp @@ -24,6 +24,7 @@ #include "cmds/vfs_cmd.h" #include "cmds/workspaces_cmd.h" +#include <zencore/callstack.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> #include <zencore/logging.h> @@ -251,7 +252,10 @@ ZenCmdBase::ResolveTargetHostSpec(const std::string& InHostSpec) return ResolveTargetHostSpec(InHostSpec, /* out */ Dummy); } -ProgressBar::ProgressBar(bool PlainProgress) : m_PlainProgress(PlainProgress), m_LastUpdateMS(m_SW.GetElapsedTimeMs() - 10000) +ProgressBar::ProgressBar(bool PlainProgress, bool ShowDetails) +: m_PlainProgress(PlainProgress) +, m_ShowDetails(ShowDetails) +, m_LastUpdateMS(m_SW.GetElapsedTimeMs() - 10000) { } @@ -270,6 +274,7 @@ ProgressBar::~ProgressBar() void ProgressBar::UpdateState(const State& NewState, bool DoLinebreak) { + ZEN_ASSERT(NewState.TotalCount >= NewState.RemainingCount); if (DoLinebreak == false && m_State == NewState) { return; @@ -288,7 +293,8 @@ ProgressBar::UpdateState(const State& NewState, bool DoLinebreak) if (m_PlainProgress) { - ZEN_CONSOLE("{} {}% ({})", NewState.Task, PercentDone, NiceTimeSpanMs(ElapsedTimeMS)); + std::string Details = (m_ShowDetails && !NewState.Details.empty()) ? fmt::format(": {}", NewState.Details) : ""; + ZEN_CONSOLE("{} {}% ({}){}", NewState.Task, PercentDone, NiceTimeSpanMs(ElapsedTimeMS), Details); } else { @@ -327,7 +333,7 @@ ProgressBar::ForceLinebreak() void ProgressBar::Finish() { - if (m_LastOutputLength > 0 && m_State.RemainingCount > 0) + if (m_LastOutputLength > 0) { State NewState = m_State; NewState.RemainingCount = 0; @@ -367,7 +373,13 @@ main(int argc, char** argv) // Set output mode to handle virtual terminal sequences zen::logging::EnableVTMode(); - std::set_terminate([]() { ZEN_CRITICAL("Program exited abnormally via std::terminate()"); }); + std::set_terminate([]() { + void* Frames[8]; + uint32_t FrameCount = GetCallstack(2, 8, Frames); + CallstackFrames* Callstack = CreateCallstack(FrameCount, Frames); + ZEN_CRITICAL("Program exited abnormally via std::terminate()\n{}", CallstackToString(Callstack, " ")); + FreeCallstack(Callstack); + }); LoggerRef DefaultLogger = zen::logging::Default(); auto& Sinks = DefaultLogger.SpdLogger->sinks(); |