controller: Make action shell command local

This commit is contained in:
patrick96 2020-05-31 21:13:12 +02:00 committed by Patrick Ziegler
parent 9fb75779f3
commit 41ffc3607d
2 changed files with 4 additions and 9 deletions

View File

@ -84,7 +84,6 @@ class controller
unique_ptr<bar> m_bar; unique_ptr<bar> m_bar;
unique_ptr<ipc> m_ipc; unique_ptr<ipc> m_ipc;
unique_ptr<inotify_watch> m_confwatch; unique_ptr<inotify_watch> m_confwatch;
unique_ptr<command<output_policy::IGNORED>> m_command;
array<unique_ptr<file_descriptor>, 2> m_queuefd{}; array<unique_ptr<file_descriptor>, 2> m_queuefd{};

View File

@ -567,15 +567,11 @@ void controller::process_inputdata() {
// Run input as command if it's not an input for a module // Run input as command if it's not an input for a module
m_log.info("Forwarding command to shell... (input: %s)", cmd); m_log.info("Forwarding command to shell... (input: %s)", cmd);
if (m_command) {
m_log.warn("Terminating previous shell command");
m_command->terminate();
}
m_log.info("Executing shell command: %s", cmd); m_log.info("Executing shell command: %s", cmd);
m_command = command_util::make_command<output_policy::IGNORED>(move(cmd));
m_command->exec(); auto shell_cmd = command_util::make_command<output_policy::IGNORED>(move(cmd));
m_command.reset(); shell_cmd->exec();
shell_cmd.reset();
process_update(true); process_update(true);
} catch (const application_error& err) { } catch (const application_error& err) {
m_log.err("controller: Error while forwarding input to shell -> %s", err.what()); m_log.err("controller: Error while forwarding input to shell -> %s", err.what());