refactor(custom): move continuous exec onto GLib command stream
Replace the custom module's continuous getline() worker with the new GLib-backed command stream helper. This moves line delivery, child exit handling, and restart scheduling onto the main loop so continuous commands no longer depend on a blocking FILE* read inside SleeperThread. The behavior is kept aligned with the old module semantics: stdout lines still emit updates, non-zero exits still surface as errors, and restart-interval still respawns the command. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
committed by
Austin Horstman
parent
560f02509b
commit
5f4b96ad1d
@@ -3,10 +3,12 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <csignal>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "AIconLabel.hpp"
|
||||
#include "util/command.hpp"
|
||||
#include "util/command_line_stream.hpp"
|
||||
#include "util/json.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
|
||||
@@ -22,6 +24,9 @@ class Custom : public AIconLabel {
|
||||
private:
|
||||
void delayWorker();
|
||||
void continuousWorker();
|
||||
void startContinuousProcess(bool throw_on_failure);
|
||||
void handleContinuousProcessExit(int exit_code);
|
||||
void scheduleContinuousRestart();
|
||||
void waitingWorker();
|
||||
void parseOutputRaw();
|
||||
void parseOutputJson();
|
||||
@@ -42,10 +47,10 @@ class Custom : public AIconLabel {
|
||||
const bool tooltip_format_enabled_;
|
||||
std::vector<std::string> class_;
|
||||
int percentage_;
|
||||
FILE* fp_;
|
||||
int pid_;
|
||||
util::command::res output_;
|
||||
util::JsonParser parser_;
|
||||
std::unique_ptr<util::command::LineStream> continuous_stream_;
|
||||
sigc::connection restart_connection_;
|
||||
|
||||
util::SleeperThread thread_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user