https://github.com/spitulax/subprocess.odin
An Odin library for spawning child processes
https://github.com/spitulax/subprocess.odin
odin odin-lang subprocess subprocess-library
Last synced: about 1 month ago
JSON representation
An Odin library for spawning child processes
- Host: GitHub
- URL: https://github.com/spitulax/subprocess.odin
- Owner: spitulax
- License: mit
- Created: 2024-11-23T18:59:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-10T15:53:45.000Z (8 months ago)
- Last Synced: 2025-08-10T17:29:17.946Z (8 months ago)
- Topics: odin, odin-lang, subprocess, subprocess-library
- Language: Odin
- Homepage:
- Size: 338 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
subprocess.odin
An Odin library for spawning child processes.
## Features
- Cross-platform (POSIX and Windows)
- Capturing output
- Sending input
- Asynchronous/parallel execution
- Command builder
- Checking if program exists
- Running shell commands (System-specific shell)
- Passing environment variables to process
## Usage
- Clone the repo to your project
- Import the package into your Odin file
## Examples
See [`demos/examples.odin`](./demos/examples.odin).
```odin
package main
import sp "subprocess"
main :: proc() {
cmd, _ := sp.command_make("cc") // Will search from PATH
// File paths are also valid
// prog, _ := sp.command_make("./bin/cc")
defer sp.command_destroy(&cmd)
sp.command_append(&cmd, "--version")
result, _ := sp.command_run(cmd, sp.Exec_Opts{output = .Capture})
defer sp.result_destroy(&result)
sp.log_info("Output:", string(result.stdout))
}
// See more examples in demos/examples.odin
// Tests are also great examples
```
## Building Docs
> [!WARNING]
> The generated documentation is not great. I advise you to look at the source code for
> documentation.
1. Compile `odin-doc`
1. Clone
2. Build it: `odin build . -out:odin-doc`
Then,
2. `make docs`
3. `cd docs/site`
4. `python3 -m http.server 10101`
5. Go to `localhost:10101`
Or alternatively,
2. `cd docs`
3. `make serve`
4. Go to `localhost:10101`
## Changelog
See [changelog](CHANGELOG.md).