1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/utils/process.hpp
patrick96 52eee95bf8 controller: Detach shell commands from polybar
Shell commands triggered from action tags used to block polybar until
they finished.

Since we are not actually interested in the output of the commands, it
makes sense to run them completely detached from polybar and have
polybar not block when executing these commands.

Now the spawned child processes no longer get killed when polybar
exits. This is fine because polybar is not responsible for these
processes since they were explicitly started by the user through click
commands.

Ref: #770
Ref: #1680
2020-11-29 03:53:59 +01:00

27 lines
709 B
C++

#pragma once
#include "common.hpp"
POLYBAR_NS
namespace process_util {
bool in_parent_process(pid_t pid);
bool in_forked_process(pid_t pid);
void redirect_stdio_to_dev_null();
pid_t fork_detached(std::function<void()> const& lambda);
void exec(char* cmd, char** args);
void exec_sh(const char* cmd);
pid_t wait_for_completion(pid_t process_id, int* status_addr = nullptr, int waitflags = 0);
pid_t wait_for_completion(int* status_addr, int waitflags = 0);
pid_t wait_for_completion_nohang(pid_t process_id, int* status);
pid_t wait_for_completion_nohang(int* status);
pid_t wait_for_completion_nohang();
bool notify_childprocess();
} // namespace process_util
POLYBAR_NS_END