|
uvw
2.0.0
|
The ProcessHandle handle. More...
#include <process.hpp>


Public Member Functions | |
| bool | init () |
| Initializes the handle. More... | |
| void | spawn (const char *file, char **args, char **env=nullptr) |
| spawn Starts the process. More... | |
| void | kill (int signum) |
| Sends the specified signal to the internal process handle. More... | |
| int | pid () noexcept |
| Gets the PID of the spawned process. More... | |
| ProcessHandle & | cwd (std::string path) noexcept |
| Sets the current working directory for the subprocess. More... | |
| ProcessHandle & | flags (Flags< Process > flags) noexcept |
Sets flags that control how spawn() behaves. More... | |
| template<typename T , typename U > | |
| ProcessHandle & | stdio (StreamHandle< T, U > &stream, Flags< StdIO > flags) |
Makes a stdio handle available to the child process. More... | |
| ProcessHandle & | stdio (FileHandle fd, Flags< StdIO > flags) |
| Makes a file descriptor available to the child process. More... | |
| ProcessHandle & | uid (Uid id) |
| Sets the child process' user id. More... | |
| ProcessHandle & | gid (Gid id) |
| Sets the child process' group id. More... | |
Public Member Functions inherited from uvw::Handle< ProcessHandle, uv_process_t > | |
| HandleCategory | category () const noexcept override |
| Gets the category of the handle. More... | |
| HandleType | type () const noexcept override |
| Gets the type of the handle. More... | |
| bool | active () const noexcept override |
| Checks if the handle is active. More... | |
| bool | closing () const noexcept override |
| Checks if a handle is closing or closed. More... | |
| void | close () noexcept override |
| Request handle to be closed. More... | |
| void | reference () noexcept override |
| Reference the given handle. More... | |
| void | unreference () noexcept override |
| Unreference the given handle. More... | |
| bool | referenced () const noexcept override |
| Checks if the given handle referenced. More... | |
| std::size_t | size () const noexcept |
| Returns the size of the underlying handle type. More... | |
| int | sendBufferSize () |
| Gets the size of the send buffer used for the socket. More... | |
| bool | sendBufferSize (int value) |
| Sets the size of the send buffer used for the socket. More... | |
| int | recvBufferSize () |
| Gets the size of the receive buffer used for the socket. More... | |
| bool | recvBufferSize (int value) |
| Sets the size of the receive buffer used for the socket. More... | |
| OSFileDescriptor | fileno () const |
| Gets the platform dependent file descriptor equivalent. More... | |
Public Member Functions inherited from uvw::UnderlyingType< ProcessHandle, uv_process_t > | |
| Loop & | loop () const noexcept |
| Gets the loop from which the resource was originated. More... | |
| const uv_process_t * | raw () const noexcept |
| Gets the underlying raw data structure. More... | |
| uv_process_t * | raw () noexcept |
| Gets the underlying raw data structure. More... | |
Public Member Functions inherited from uvw::Emitter< ProcessHandle > | |
| Connection< E > | on (Listener< E > f) |
| Registers a long-lived listener with the event emitter. More... | |
| Connection< E > | once (Listener< E > f) |
| Registers a short-lived listener with the event emitter. More... | |
| void | erase (Connection< E > conn) noexcept |
| Disconnects a listener from the event emitter. More... | |
| void | clear () noexcept |
| Disconnects all the listeners for the given event type. | |
| void | clear () noexcept |
| Disconnects all the listeners. | |
| bool | empty () const noexcept |
| Checks if there are listeners registered for the specific event. More... | |
| bool | empty () const noexcept |
| Checks if there are listeners registered with the event emitter. More... | |
Static Public Member Functions | |
| static void | disableStdIOInheritance () noexcept |
| Disables inheritance for file descriptors/handles. More... | |
| static bool | kill (int pid, int signum) noexcept |
| kill Sends the specified signal to the given PID. More... | |
Static Public Member Functions inherited from uvw::UnderlyingType< ProcessHandle, uv_process_t > | |
| static std::shared_ptr< ProcessHandle > | create (Args &&... args) |
| Creates a new resource of the given type. More... | |
The ProcessHandle handle.
Process handles will spawn a new process and allow the user to control it and establish communication channels with it using streams.
Definition at line 67 of file process.hpp.
|
inlinenoexcept |
Sets the current working directory for the subprocess.
| path | The working directory to be used when spawn() is invoked. |
Definition at line 184 of file process.hpp.
|
inlinestaticnoexcept |
Disables inheritance for file descriptors/handles.
Disables inheritance for file descriptors/handles that this process inherited from its parent. The effect is that child processes spawned by this process don’t accidentally inherit these handles.
It is recommended to call this function as early in your program as possible, before the inherited file descriptors can be closed or duplicated.
See the official documentation for further details.
Definition at line 95 of file process.hpp.
|
inlinenoexcept |
Sets flags that control how spawn() behaves.
Available flags are:
ProcessHandle::Process::SETUIDProcessHandle::Process::SETGIDProcessHandle::Process::WINDOWS_VERBATIM_ARGUMENTSProcessHandle::Process::DETACHEDProcessHandle::Process::WINDOWS_HIDEProcessHandle::Process::WINDOWS_HIDE_CONSOLEProcessHandle::Process::WINDOWS_HIDE_GUISee the official documentation for further details.
| flags | A valid set of flags. |
Definition at line 209 of file process.hpp.
|
inline |
Sets the child process' group id.
| id | A valid group id to be used. |
Definition at line 308 of file process.hpp.
|
inline |
Initializes the handle.
Definition at line 113 of file process.hpp.
|
inlinestaticnoexcept |
kill Sends the specified signal to the given PID.
| pid | A valid process id. |
| signum | A valid signal identifier. |
Definition at line 105 of file process.hpp.
|
inline |
Sends the specified signal to the internal process handle.
| signum | A valid signal identifier. |
Definition at line 164 of file process.hpp.
|
inlinenoexcept |
Gets the PID of the spawned process.
It’s set after calling spawn().
Definition at line 175 of file process.hpp.
|
inline |
spawn Starts the process.
If the process isn't successfully spawned, an ErrorEvent event will be emitted by the handle.
See the official documentation for further details.
| file | Path pointing to the program to be executed. |
| args | Command line arguments. |
| env | Optional environment for the new process. |
Definition at line 133 of file process.hpp.
|
inline |
Makes a stdio handle available to the child process.
Available flags are:
ProcessHandle::StdIO::IGNORE_STREAMProcessHandle::StdIO::CREATE_PIPEProcessHandle::StdIO::INHERIT_FDProcessHandle::StdIO::INHERIT_STREAMProcessHandle::StdIO::READABLE_PIPEProcessHandle::StdIO::WRITABLE_PIPEProcessHandle::StdIO::OVERLAPPED_PIPESee the official documentation for further details.
| stream | A valid stdio handle. |
| flags | A valid set of flags. |
Definition at line 236 of file process.hpp.
|
inline |
Makes a file descriptor available to the child process.
Available flags are:
ProcessHandle::StdIO::IGNORE_STREAMProcessHandle::StdIO::CREATE_PIPEProcessHandle::StdIO::INHERIT_FDProcessHandle::StdIO::INHERIT_STREAMProcessHandle::StdIO::READABLE_PIPEProcessHandle::StdIO::WRITABLE_PIPEProcessHandle::StdIO::OVERLAPPED_PIPEDefault file descriptors are:
uvw::StdIN for stdinuvw::StdOUT for stdoutuvw::StdERR for stderrSee the official documentation for further details.
| fd | A valid file descriptor. |
| flags | A valid set of flags. |
Definition at line 271 of file process.hpp.
|
inline |
Sets the child process' user id.
| id | A valid user id to be used. |
Definition at line 298 of file process.hpp.
1.8.13