diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index f010209e..64577509 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -88,7 +88,7 @@ void waybar::modules::Custom::continuousWorker() { continuous_stream_ = std::make_unique( 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_); } diff --git a/src/util/command_line_stream.cpp b/src/util/command_line_stream.cpp index b13cc19b..aeeedfaf 100644 --- a/src/util/command_line_stream.cpp +++ b/src/util/command_line_stream.cpp @@ -91,9 +91,9 @@ void waybar::util::command::LineStream::start(const std::string& cmd) { stop(); std::vector 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) { diff --git a/test/utils/command_line_stream.cpp b/test/utils/command_line_stream.cpp index 8c1639e3..b852a6e8 100644 --- a/test/utils/command_line_stream.cpp +++ b/test/utils/command_line_stream.cpp @@ -33,8 +33,7 @@ auto run_stream_command(const std::string& cmd) -> StreamResult { 3000); waybar::util::command::LineStream stream( - "", - [&](const std::string& line) { result.lines.push_back(line); }, + "", [&](const std::string& line) { result.lines.push_back(line); }, [&](int exit_code) { result.exit_code = exit_code; loop->quit();