| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Process management module for Vix.cpp.
vix::process provides a production-ready API to spawn, control, and interact with system processes.
It is designed for:
#include <vix/process/Process.hpp>
int main()
{
vix::process::Command cmd("echo");
cmd.arg("hello from vix");
auto result = vix::process::spawn(cmd);
if (!result)
{
return 1;
}
return 0;
}vix::process::Command cmd("program");
cmd.arg("value");
cmd.args({"a", "b", "c"});
cmd.cwd("/working/dir");
cmd.env("KEY", "VALUE");
cmd.stdout_mode(vix::process::PipeMode::Pipe);
cmd.stderr_mode(vix::process::PipeMode::Pipe);
cmd.detach(false);
cmd.search_in_path(true);auto child = vix::process::spawn(cmd);
auto result = vix::process::wait(child.value());
int exit_code = result.value();cmd.stdout_mode(vix::process::PipeMode::Pipe);
cmd.stderr_mode(vix::process::PipeMode::Pipe);
auto result = vix::process::output(cmd);
auto out = result.value();
std::cout << out.stdout_text;
std::cout << out.stderr_text;vix::process::Command producer("echo");
producer.arg("hello world");
vix::process::Command consumer("cat");
auto children = vix::process::pipeline::spawn(producer, consumer).value();
auto result = vix::process::pipeline::wait(children).value();
std::cout << result.first_exit_code;
std::cout << result.second_exit_code;vix::process::kill(child); // force (SIGKILL / TerminateProcess)
vix::process::terminate(child); // graceful (SIGTERM / best effort)auto running = vix::process::status(child);
if (running.value())
{
// still running
}auto child = co_await vix::process::async::spawn(ctx, cmd);
int code = co_await vix::process::async::wait(ctx, child);Pipeline async:
auto children =
co_await vix::process::pipeline::async::spawn(ctx, p1, p2);
auto result =
co_await vix::process::pipeline::async::wait(ctx, children);All operations return Result<T> or Error.
auto result = vix::process::spawn(cmd);
if (!result)
{
auto err = result.error();
}No hidden exceptions unless explicitly using async wrappers.
This module does not use a shell.
Command("ls -la"); // WRONG
Command("ls").args({"-la"}); // CORRECTIf you need shell features (pipes, redirects, etc), you must explicitly call:
Command("sh").arg("-c").arg("echo hello | sort");This keeps behavior:
examples/
|- basic_spawn.cpp
|- wait_process.cpp
|- capture_output.cpp
|- check_status.cpp
|- kill_process.cpp
|- terminate_process.cpp
|- pipeline_basic.cpp
|- pipeline_output.cpp
|- output_large.cpp
`- async/
|- async_spawn_wait.cpp
|- async_output.cpp
|- async_cancel.cpp
`- async_pipeline.cpp
Some features may still return:
MIT License
Copyright (c) 2026 Gaspard Kirira
https://github.com/vixcpp/vix
| Back | FazBrowse Home | New Git URL |