File: process.hpp

package info (click to toggle)
polybar 3.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,108 kB
  • sloc: cpp: 30,424; python: 3,750; sh: 284; makefile: 83
file content (32 lines) | stat: -rw-r--r-- 860 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <sys/types.h>

#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 spawn_async(std::function<void()> const& lambda);
  void fork_detached(std::function<void()> const& lambda);

  void exec(char* cmd, char** args);
  void exec_sh(const char* cmd, const vector<pair<string, string>>& env = {});

  int wait(pid_t pid);

  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