Stop ipc_module subclassing static_module
This commit is contained in:
parent
f55f584ef7
commit
6b6bcf5080
@ -12,7 +12,7 @@ namespace modules {
|
|||||||
* shell script and the resulting output will be used
|
* shell script and the resulting output will be used
|
||||||
* as the module content.
|
* as the module content.
|
||||||
*/
|
*/
|
||||||
class ipc_module : public static_module<ipc_module> {
|
class ipc_module : public module<ipc_module> {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Hook structure that will be fired
|
* Hook structure that will be fired
|
||||||
|
@ -14,7 +14,7 @@ namespace modules {
|
|||||||
* Load user-defined ipc hooks and
|
* Load user-defined ipc hooks and
|
||||||
* create formatting tags
|
* create formatting tags
|
||||||
*/
|
*/
|
||||||
ipc_module::ipc_module(const bar_settings& bar, string name_) : static_module<ipc_module>(bar, move(name_)) {
|
ipc_module::ipc_module(const bar_settings& bar, string name_) : module<ipc_module>(bar, move(name_)) {
|
||||||
m_router->register_action_with_data(EVENT_SEND, &ipc_module::action_send);
|
m_router->register_action_with_data(EVENT_SEND, &ipc_module::action_send);
|
||||||
|
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@ -56,13 +56,18 @@ namespace modules {
|
|||||||
* Start module and run first defined hook if configured to
|
* Start module and run first defined hook if configured to
|
||||||
*/
|
*/
|
||||||
void ipc_module::start() {
|
void ipc_module::start() {
|
||||||
|
m_mainthread = thread([&] {
|
||||||
|
m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id()));
|
||||||
|
update();
|
||||||
|
broadcast();
|
||||||
|
});
|
||||||
|
|
||||||
if (m_initial) {
|
if (m_initial) {
|
||||||
// TODO do this in a thread.
|
// TODO do this in a thread.
|
||||||
auto command = command_util::make_command<output_policy::REDIRECTED>(m_hooks.at(m_initial - 1)->command);
|
auto command = command_util::make_command<output_policy::REDIRECTED>(m_hooks.at(m_initial - 1)->command);
|
||||||
command->exec(false);
|
command->exec(false);
|
||||||
command->tail([this](string line) { m_output = line; });
|
command->tail([this](string line) { m_output = line; });
|
||||||
}
|
}
|
||||||
static_module::start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user