summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-30 00:34:33 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-30 00:34:33 +0000
commitb27b128f97596236a4ce6a3d9b40ef3dfad84d06 (patch)
tree00d17aeee6f84fb3641d0b84e1931f9a88649cac /docs
parentee090168fd7f678e40150b3699e335625b90d947 (diff)
New standard lib (std/process.zc).
Diffstat (limited to 'docs')
-rw-r--r--docs/std/README.md1
-rw-r--r--docs/std/process.md57
2 files changed, 58 insertions, 0 deletions
diff --git a/docs/std/README.md b/docs/std/README.md
index 16ffc74..3cbf8f8 100644
--- a/docs/std/README.md
+++ b/docs/std/README.md
@@ -8,6 +8,7 @@
- [Networking (Net)](./net.md) - TCP networking.
- [Option](./option.md) - Optional values (Some/None).
- [Path](./path.md) - File path manipulation.
+- [Process](./process.md) - Process execution and management.
- [Result](./result.md) - Error handling (Ok/Err).
- [Queue](./queue.md) - FIFO queue (Ring Buffer).
- [Set](./set.md) - Hash set implementation.
diff --git a/docs/std/process.md b/docs/std/process.md
new file mode 100644
index 0000000..31485ee
--- /dev/null
+++ b/docs/std/process.md
@@ -0,0 +1,57 @@
+# Standard Library: Process (`std/process.zc`)
+
+The process module allows you to spawn and interact with child processes.
+
+## Usage
+
+```zc
+import "std/process.zc"
+
+fn main() {
+ let output = Command::new("echo")
+ .arg("hello")
+ .output();
+
+ if (output.exit_code == 0) {
+ output.stdout.print();
+ // Or access raw C string: output.stdout.c_str()
+ }
+}
+```
+
+## Structs
+
+### Command
+
+A builder for spawning a process.
+
+```zc
+struct Command {
+ program: String;
+ args: Vec<String>;
+}
+```
+
+#### Methods
+
+| Method | Signature | Description |
+| :--- | :--- | :--- |
+| **new** | `Command::new(program: char*) -> Command` | Creates a new Command for the given program. |
+| **arg** | `arg(self, arg: char*) -> Command*` | Adds an argument to the command. Returns the command pointer for chaining. |
+| **output** | `output(self) -> Output` | Executes the command as a child process, waiting for it to finish and collecting all of its stdout. |
+| **status** | `status(self) -> int` | Executes the command as a child process and returns the exit status code. Does not capture output (output goes to stdout/stderr). |
+
+### Output
+
+The output of a finished process.
+
+```zc
+struct Output {
+ stdout: String;
+ exit_code: int;
+}
+```
+
+#### Methods
+
+`Output` implements `Drop` to automatically free the captured `stdout` string.