mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
Add Process functions for detached spawning
This commit is contained in:
+24
-1
@@ -94,7 +94,8 @@ class ProcessEnvironment {
|
||||
|
||||
/**
|
||||
* A child process whose output can be captured. Simple wrapper around the Posix
|
||||
* APIs.
|
||||
* APIs. The functions provided for running processes this way are very much
|
||||
* tailored towards yabridge's needs.
|
||||
*/
|
||||
class Process {
|
||||
public:
|
||||
@@ -110,6 +111,8 @@ class Process {
|
||||
protected:
|
||||
Handle(pid_t pid);
|
||||
|
||||
friend Process;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Terminates the process when it gets dropped.
|
||||
@@ -195,6 +198,26 @@ class Process {
|
||||
*/
|
||||
StatusResult spawn_get_status() const;
|
||||
|
||||
/**
|
||||
* Spawn the process without waiting for its completion, leave STDIN alone,
|
||||
* create pipes for STDOUT and STDERR, and assign those to the provided
|
||||
* (empty) stream descriptors. Use `posix_spawn()`, closes all non-STDIO
|
||||
* file descriptors. The process will be terminated when the child process
|
||||
* handle gets dropped.
|
||||
*/
|
||||
HandleResult spawn_child_piped(
|
||||
asio::posix::stream_descriptor& stdout_pipe,
|
||||
asio::posix::stream_descriptor& stderr_pipe) const;
|
||||
|
||||
/**
|
||||
* Spawn the process without waiting for its completion, leave STDIN alone,
|
||||
* and redirect STDOUT and STDERR to a file. Use `posix_spawn()`, closes all
|
||||
* non-STDIO file descriptors. The process will be terminated when the child
|
||||
* process handle gets dropped.
|
||||
*/
|
||||
HandleResult spawn_child_redirected(
|
||||
const ghc::filesystem::path& filename) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Create the `argv` array from the command and the arguments. Only valid as
|
||||
|
||||
Reference in New Issue
Block a user