style(custom): apply format and tidy cleanups
Run clang-format on the changed C++ files and fix the clang-tidy findings introduced by the custom command migration. The only codegen-relevant change here is switching the new res assignments in custom.cpp to designated initializers. The rest is formatting only. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
committed by
Austin Horstman
parent
fc01c03a20
commit
f987c24144
@@ -88,7 +88,7 @@ void waybar::modules::Custom::continuousWorker() {
|
||||
continuous_stream_ = std::make_unique<util::command::LineStream>(
|
||||
output_name_,
|
||||
[this](const std::string& output) {
|
||||
output_ = {0, output};
|
||||
output_ = {.exit_code = 0, .out = output};
|
||||
dp.emit();
|
||||
},
|
||||
[this](int exit_code) { handleContinuousProcessExit(exit_code); });
|
||||
@@ -104,7 +104,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
|
||||
if (throw_on_failure) {
|
||||
throw std::runtime_error("Unable to open " + cmd + ": " + e.what().raw());
|
||||
}
|
||||
output_ = {1, ""};
|
||||
output_ = {.exit_code = 1, .out = ""};
|
||||
dp.emit();
|
||||
spdlog::error("Unable to restart {}: {}", name_, e.what().raw());
|
||||
scheduleContinuousRestart();
|
||||
@@ -112,7 +112,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
|
||||
if (throw_on_failure) {
|
||||
throw;
|
||||
}
|
||||
output_ = {1, ""};
|
||||
output_ = {.exit_code = 1, .out = ""};
|
||||
dp.emit();
|
||||
spdlog::error("Unable to restart {}: {}", name_, e.what());
|
||||
scheduleContinuousRestart();
|
||||
@@ -121,7 +121,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
|
||||
|
||||
void waybar::modules::Custom::handleContinuousProcessExit(int exit_code) {
|
||||
if (exit_code != 0) {
|
||||
output_ = {exit_code, ""};
|
||||
output_ = {.exit_code = exit_code, .out = ""};
|
||||
dp.emit();
|
||||
spdlog::error("{} stopped unexpectedly, is it endless?", name_);
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ void waybar::util::command::LineStream::start(const std::string& cmd) {
|
||||
stop();
|
||||
|
||||
std::vector<std::string> argv{"/bin/sh", "-c", cmd};
|
||||
Glib::spawn_async_with_pipes(
|
||||
"", argv, Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_CLOEXEC_PIPES,
|
||||
sigc::bind(sigc::ptr_fun(&prepareChild), output_name_), &pid_, nullptr, &stdout_fd_, nullptr);
|
||||
Glib::spawn_async_with_pipes("", argv, Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_CLOEXEC_PIPES,
|
||||
sigc::bind(sigc::ptr_fun(&prepareChild), output_name_), &pid_,
|
||||
nullptr, &stdout_fd_, nullptr);
|
||||
|
||||
const auto flags = fcntl(stdout_fd_, F_GETFL, 0);
|
||||
if (flags == -1 || fcntl(stdout_fd_, F_SETFL, flags | O_NONBLOCK) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user