7#include <initializer_list>
17#include "wpi/util/SmallVector.hpp"
30 struct private_init {};
234 std::span<const Option> options);
238 std::initializer_list<Option> options) {
242 template <
typename... Args>
244 const Args&... options) {
262 std::string_view
file,
263 std::span<const Option> options) {
268 const std::shared_ptr<Loop>&
loop, std::string_view
file,
269 std::initializer_list<Option> options) {
273 template <
typename... Args>
274 static std::shared_ptr<Process>
Spawn(
const std::shared_ptr<Loop>&
loop,
275 std::string_view
file,
276 const Args&... options) {
292 static int Kill(
int pid,
int signum)
noexcept {
return uv_kill(pid, signum); }
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
Definition ThirdPartyNotices.txt:204
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Returns a named argument to be used in a formatting function.
Definition base.h:2846
@ index
Definition base.h:690
bool Invoke(F &&f, Args &&... args) const
Definition Handle.hpp:265
uv_process_t * GetRaw() const noexcept
Definition Handle.hpp:303
HandleImpl()
Definition Handle.hpp:308
Event loop.
Definition Loop.hpp:35
Pipe handle.
Definition Pipe.hpp:26
static std::shared_ptr< Process > SpawnArray(const std::shared_ptr< Loop > &loop, std::string_view file, std::initializer_list< Option > options)
Definition Process.hpp:267
static Option StdioCreatePipe(size_t index, Pipe &pipe, unsigned int flags)
Create a pipe between the child and the parent.
Definition Process.hpp:201
Process(const private_init &)
Definition Process.hpp:33
static Option StdioIgnore(size_t index)
Explicitly ignore a stdio.
Definition Process.hpp:164
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.hpp:261
static std::shared_ptr< Process > SpawnArray(Loop &loop, std::string_view file, std::span< const Option > options)
Starts a process.
static Option Uid(uv_uid_t uid)
Set the child process' user id.
Definition Process.hpp:124
wpi::util::sig::Signal< int64_t, int > exited
Signal generated when the process exits.
Definition Process.hpp:304
static std::shared_ptr< Process > Spawn(Loop &loop, std::string_view file, const Args &... options)
Definition Process.hpp:243
void Kill(int signum)
Sends the specified signal to the process.
Definition Process.hpp:284
static Option Gid(uv_gid_t gid)
Set the child process' group id.
Definition Process.hpp:134
~Process() noexcept override=default
static void DisableStdioInheritance()
Disables inheritance for file descriptors / handles that this process inherited from its parent.
Definition Process.hpp:218
uv_pid_t GetPid() const noexcept
Get the process ID.
Definition Process.hpp:298
static int Kill(int pid, int signum) noexcept
Sends the specified signal to the given PID.
Definition Process.hpp:292
static Option Env(std::string_view env)
Set environment variable for the subprocess.
Definition Process.hpp:102
static Option SetFlags(unsigned int flags)
Set spawn flags.
Definition Process.hpp:144
static Option StdioInherit(size_t index, Pipe &pipe)
Inherit a pipe from the parent process.
Definition Process.hpp:187
static std::shared_ptr< Process > SpawnArray(Loop &loop, std::string_view file, std::initializer_list< Option > options)
Definition Process.hpp:236
static std::shared_ptr< Process > Spawn(const std::shared_ptr< Loop > &loop, std::string_view file, const Args &... options)
Definition Process.hpp:274
static Option StdioInherit(size_t index, int fd)
Inherit a file descriptor from the parent process.
Definition Process.hpp:175
static Option Cwd(std::string_view cwd)
Set the current working directory for the subprocess.
Definition Process.hpp:113
static Option ClearFlags(unsigned int flags)
Clear spawn flags.
Definition Process.hpp:154
Definition BooleanTopic.hpp:24
Definition Prepare.hpp:14
flags
Definition http_parser.hpp:206
SignalBase< detail::NullMutex, T... > Signal
Specialization of SignalBase to be used in single threaded contexts.
Definition Signal.h:809
int pid
Definition uv.h:1144
Structure for Spawn() option temporaries.
Definition Process.hpp:41
Option(const wpi::util::SmallVectorImpl< char > &arg)
Definition Process.hpp:72
Option(Type type)
Definition Process.hpp:77
Type
Definition Process.hpp:42
@ kCwd
Definition Process.hpp:46
@ kUid
Definition Process.hpp:47
@ kStdioInheritFd
Definition Process.hpp:52
@ kStdioInheritPipe
Definition Process.hpp:53
@ kGid
Definition Process.hpp:48
@ kStdioCreatePipe
Definition Process.hpp:54
@ kEnv
Definition Process.hpp:45
@ kSetFlags
Definition Process.hpp:49
@ kClearFlags
Definition Process.hpp:50
@ kNone
Definition Process.hpp:43
@ kArg
Definition Process.hpp:44
@ kStdioIgnore
Definition Process.hpp:51
const char * str
Definition Process.hpp:82
Option()
Definition Process.hpp:57
Pipe * pipe
Definition Process.hpp:90
Type m_type
Definition Process.hpp:79
union wpi::net::uv::Process::Option::@071353211124055204151244037274343020353135212202 m_data
Option(const std::string &arg)
Definition Process.hpp:63
std::string m_strData
Definition Process.hpp:80
struct wpi::net::uv::Process::Option::@071353211124055204151244037274343020353135212202::@123141332073265301115027032264254307124073022137 stdio
size_t index
Definition Process.hpp:87
uv_gid_t gid
Definition Process.hpp:84
Option(std::string_view arg)
Definition Process.hpp:67
int fd
Definition Process.hpp:89
Option(const char *arg)
Definition Process.hpp:59
unsigned int flags
Definition Process.hpp:85
uv_uid_t uid
Definition Process.hpp:83
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)