fix: output --version to stdout (#5727)

This commit is contained in:
pajlada
2024-11-23 14:20:44 +01:00
committed by GitHub
parent 2a38e39e24
commit a8269a5749
2 changed files with 14 additions and 8 deletions
+1
View File
@@ -128,6 +128,7 @@
- Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668) - Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668)
- Dev: Refactored IRC message building. (#5663) - Dev: Refactored IRC message building. (#5663)
- Dev: Fixed some compiler warnings. (#5672) - Dev: Fixed some compiler warnings. (#5672)
- Dev: Explicitly print output from `--version` to `stdout`. (#5727)
- Dev: Unified parsing of historic and live IRC messages. (#5678) - Dev: Unified parsing of historic and live IRC messages. (#5678)
- Dev: 7TV's `entitlement.reset` is now explicitly ignored. (#5685) - Dev: 7TV's `entitlement.reset` is now explicitly ignored. (#5685)
- Dev: Qt 6.8 and later now default to the GDI fontengine. (#5710) - Dev: Qt 6.8 and later now default to the GDI fontengine. (#5710)
+13 -8
View File
@@ -44,13 +44,16 @@ int main(int argc, char **argv)
QMessageBox box; QMessageBox box;
if (Modes::instance().isPortable) if (Modes::instance().isPortable)
{ {
box.setText( auto errorMessage =
error.what() + error.what() +
QStringLiteral( QStringLiteral(
"\n\nInfo: Portable mode requires the application to " "\n\nInfo: Portable mode requires the application to "
"be in a writeable location. If you don't want " "be in a writeable location. If you don't want "
"portable mode reinstall the application. " "portable mode reinstall the application. "
"https://chatterino.com.")); "https://chatterino.com.");
std::cerr << errorMessage.toLocal8Bit().constData() << '\n';
std::cerr.flush();
box.setText(errorMessage);
} }
else else
{ {
@@ -77,12 +80,14 @@ int main(int argc, char **argv)
attachToConsole(); attachToConsole();
auto version = Version::instance(); auto version = Version::instance();
qInfo().noquote() << QString("%1 (commit %2%3)") auto versionMessage =
.arg(version.fullVersion()) QString("%1 (commit %2%3)")
.arg(version.commitHash()) .arg(version.fullVersion())
.arg(Modes::instance().isNightly .arg(version.commitHash())
? ", " + version.dateOfBuild() .arg(Modes::instance().isNightly ? ", " + version.dateOfBuild()
: ""); : "");
std::cout << versionMessage.toLocal8Bit().constData() << '\n';
std::cout.flush();
} }
else else
{ {