5#ifndef WPINET_UV_PROCESS_H_
6#define WPINET_UV_PROCESS_H_
10#include <initializer_list>
32 struct private_init {};
66 m_data.str =
arg.data();
71 m_data.str = m_strData.c_str();
75 : m_strData(
arg.data(),
arg.size()) {
76 m_data.str = m_strData.c_str();
236 std::span<const Option> options);
240 std::initializer_list<Option> options) {
244 template <
typename... Args>
246 const Args&... options) {
263 static std::shared_ptr<Process>
SpawnArray(
const std::shared_ptr<Loop>& loop,
265 std::span<const Option> options) {
271 std::initializer_list<Option> options) {
275 template <
typename... Args>
276 static std::shared_ptr<Process>
Spawn(
const std::shared_ptr<Loop>& loop,
278 const Args&... options) {
294 static int Kill(
int pid,
int signum)
noexcept {
return uv_kill(pid, signum); }
This file defines the SmallVector class.
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
Definition: ThirdPartyNotices.txt:192
SignalBase is an implementation of the observer pattern, through the use of an emitting object and sl...
Definition: Signal.h:495
bool Invoke(F &&f, Args &&... args) const
Definition: Handle.h:267
Handle.
Definition: Handle.h:290
uv_process_t * GetRaw() const noexcept
Get the underlying handle data structure.
Definition: Handle.h:305
Event loop.
Definition: Loop.h:37
Pipe handle.
Definition: Pipe.h:27
Process handle.
Definition: Process.h:31
static Option StdioCreatePipe(size_t index, Pipe &pipe, unsigned int flags)
Create a pipe between the child and the parent.
Definition: Process.h:203
static std::shared_ptr< Process > Spawn(Loop &loop, std::string_view file, const Args &... options)
Definition: Process.h:245
static Option StdioIgnore(size_t index)
Explicitly ignore a stdio.
Definition: Process.h:166
uv_pid_t GetPid() const noexcept
Get the process ID.
Definition: Process.h:300
static std::shared_ptr< Process > SpawnArray(const std::shared_ptr< Loop > &loop, std::string_view file, std::initializer_list< Option > options)
Definition: Process.h:269
static Option SetFlags(unsigned int flags)
Set spawn flags.
Definition: Process.h:146
static std::shared_ptr< Process > SpawnArray(const std::shared_ptr< Loop > &loop, std::string_view file, std::span< const Option > options)
Starts a process.
Definition: Process.h:263
static Option Env(std::string_view env)
Set environment variable for the subprocess.
Definition: Process.h:104
sig::Signal< int64_t, int > exited
Signal generated when the process exits.
Definition: Process.h:306
static int Kill(int pid, int signum) noexcept
Sends the specified signal to the given PID.
Definition: Process.h:294
static std::shared_ptr< Process > SpawnArray(Loop &loop, std::string_view file, std::initializer_list< Option > options)
Definition: Process.h:238
static void DisableStdioInheritance()
Disables inheritance for file descriptors / handles that this process inherited from its parent.
Definition: Process.h:220
static Option Cwd(std::string_view cwd)
Set the current working directory for the subprocess.
Definition: Process.h:115
Process(const private_init &)
Definition: Process.h:35
static Option Uid(uv_uid_t uid)
Set the child process' user id.
Definition: Process.h:126
~Process() noexcept override=default
static Option Gid(uv_gid_t gid)
Set the child process' group id.
Definition: Process.h:136
static std::shared_ptr< Process > Spawn(const std::shared_ptr< Loop > &loop, std::string_view file, const Args &... options)
Definition: Process.h:276
static Option StdioInherit(size_t index, int fd)
Inherit a file descriptor from the parent process.
Definition: Process.h:177
void Kill(int signum)
Sends the specified signal to the process.
Definition: Process.h:286
static Option ClearFlags(unsigned int flags)
Clear spawn flags.
Definition: Process.h:156
static Option StdioInherit(size_t index, Pipe &pipe)
Inherit a pipe from the parent process.
Definition: Process.h:189
static std::shared_ptr< Process > SpawnArray(Loop &loop, std::string_view file, std::span< const Option > options)
Starts a process.
basic_string_view< char > string_view
Definition: core.h:501
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
\rst Returns a named argument to be used in a formatting function.
Definition: core.h:1841
type
Definition: core.h:556
Definition: WebSocket.h:27
int pid
Definition: uv.h:1109
Structure for Spawn() option temporaries.
Definition: Process.h:43
Option(const char *arg)
Definition: Process.h:61
Option()
Definition: Process.h:59
int fd
Definition: Process.h:91
const char * str
Definition: Process.h:84
Option(const std::string &arg)
Definition: Process.h:65
Pipe * pipe
Definition: Process.h:92
uv_gid_t gid
Definition: Process.h:86
struct wpi::uv::Process::Option::@13::@14 stdio
union wpi::uv::Process::Option::@13 m_data
uv_uid_t uid
Definition: Process.h:85
size_t index
Definition: Process.h:89
unsigned int flags
Definition: Process.h:87
Option(std::string_view arg)
Definition: Process.h:69
Option(Type type)
Definition: Process.h:79
std::string m_strData
Definition: Process.h:82
Option(const SmallVectorImpl< char > &arg)
Definition: Process.h:74
Type
Definition: Process.h:44
@ kSetFlags
Definition: Process.h:51
@ kGid
Definition: Process.h:50
@ kNone
Definition: Process.h:45
@ kStdioInheritFd
Definition: Process.h:54
@ kClearFlags
Definition: Process.h:52
@ kEnv
Definition: Process.h:47
@ kUid
Definition: Process.h:49
@ kStdioCreatePipe
Definition: Process.h:56
@ kArg
Definition: Process.h:46
@ kCwd
Definition: Process.h:48
@ kStdioIgnore
Definition: Process.h:53
@ kStdioInheritPipe
Definition: Process.h:55
flags
Definition: http_parser.h:206
uid_t uv_uid_t
Definition: unix.h:158
pid_t uv_pid_t
Definition: unix.h:120
gid_t uv_gid_t
Definition: unix.h:157
UV_EXTERN int uv_process_kill(uv_process_t *, int signum)
UV_EXTERN int uv_kill(int pid, int signum)
UV_EXTERN void uv_disable_stdio_inheritance(void)