libutil: remove ErrorInfo::programName

it's effectively unused. one use is a write and a read immediately after
the write, the other use checks whether it's not equal to itself (..wat)

Change-Id: I5f6ce26e75a6bfa500c2e9ac3fc70e8dafc9bd74
This commit is contained in:
eldritch horrors
2025-07-14 17:02:30 +00:00
parent 2090853b80
commit d20c3d3643
3 changed files with 2 additions and 11 deletions
+1 -2
View File
@@ -317,11 +317,10 @@ int handleExceptions(const std::string & programName, std::function<void()> fun)
{
ReceiveInterrupts receiveInterrupts; // FIXME: need better place for this
ErrorInfo::programName = baseNameOf(programName);
/* Lix command line is not yet stabilized.
* Explain that it is experimental and reserved for custom subcommands for now.
* */
bool onlyForSubcommands = ErrorInfo::programName == "lix";
bool onlyForSubcommands = baseNameOf(programName) == "lix";
std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
try {
+1 -7
View File
@@ -33,8 +33,6 @@ const std::string & BaseError::calcWhat() const
}
}
std::optional<std::string> ErrorInfo::programName = std::nullopt;
std::ostream & operator <<(std::ostream & os, const HintFmt & hf)
{
return os << hf.str();
@@ -264,11 +262,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
assert(false);
}
// FIXME: show the program name as part of the trace?
if (einfo.programName && einfo.programName != ErrorInfo::programName)
prefix += fmt(" [%s]:" ANSI_NORMAL " ", einfo.programName.value_or(""));
else
prefix += ":" ANSI_NORMAL " ";
prefix += ":" ANSI_NORMAL " ";
std::ostringstream oss;
-2
View File
@@ -89,8 +89,6 @@ struct ErrorInfo {
unsigned int status = 1;
Suggestions suggestions = {};
static std::optional<std::string> programName;
};
std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool showTrace);