Coroutine-based pipeline helpers used to connect OpenOS processes through read/write streams.
- Repository:
opencomputers - System:
openos - Type:
library
OpenComputers/src\main\resources\assets\opencomputers\loot\openos\lib\pipe.lua
local pipe = require("pipe")- Description: Link a list of loaded process threads into
prog1 | prog2 | ...style pipe connections. - Parameters:
progs: Array of process root coroutines in pipeline order.
pipe.buildPipeChain({producer, consumer})- Description: Wrap a root coroutine or function in a coroutine handler that can yield across pipe boundaries safely.
- Parameters:
root: Existing process coroutine or function entry point to wrap.env: Optional environment table used whenrootis a function and must be loaded as a process.name: Optional process name used when loading a function root.
local stack = pipe.createCoroutineStack(threadRoot)- Description: Start one command behind a controller stream and return a buffered handle for reading from or writing to it.
- Parameters:
prog: Shell command line to execute.mode: Either"r"to read command output or"w"to write command input.env: Optional environment table passed into the spawned shell execution.
local handle = pipe.popen("ls /etc", "r")- The implementation builds dedicated coroutine stacks so natural yields and pipe reads can coexist correctly across chained commands.