2016-06-15 03:32:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-12 00:07:13 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2016-06-15 03:32:35 +00:00
|
|
|
#include "common.hpp"
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
namespace process_util {
|
2016-11-02 19:22:45 +00:00
|
|
|
bool in_parent_process(pid_t pid);
|
|
|
|
bool in_forked_process(pid_t pid);
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2020-11-25 11:16:06 +00:00
|
|
|
void redirect_stdio_to_dev_null();
|
|
|
|
|
2020-12-12 01:21:36 +00:00
|
|
|
pid_t spawn_async(std::function<void()> const& lambda);
|
|
|
|
void fork_detached(std::function<void()> const& lambda);
|
2020-05-06 20:28:05 +00:00
|
|
|
|
2016-12-03 14:46:48 +00:00
|
|
|
void exec(char* cmd, char** args);
|
2021-09-28 18:32:26 +00:00
|
|
|
void exec_sh(const char* cmd, const vector<pair<string, string>>& env = {});
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2020-12-12 01:21:36 +00:00
|
|
|
int wait(pid_t pid);
|
|
|
|
|
2020-11-25 11:16:06 +00:00
|
|
|
pid_t wait_for_completion(pid_t process_id, int* status_addr = nullptr, int waitflags = 0);
|
2016-11-02 19:22:45 +00:00
|
|
|
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();
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-02 19:22:45 +00:00
|
|
|
bool notify_childprocess();
|
2020-11-25 11:16:06 +00:00
|
|
|
} // namespace process_util
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|