Pudu programming language
Menu
API reference

Std.Process.pipe

1 declaration

fn

pipe: Str -> &Array[Str] -> Str -> &Array[Str] -> Result[Std.Process.Finished, Str]

This is a callable function.

What it does

Feed one program's output into another's input, and answer what comes out.

The shape a shell writes with a vertical bar, and it is written here

because doing it by hand goes wrong in two ways that look like the program

hanging rather than like a mistake.

Both run at once. Reading the first program to its end before starting

the second would hold everything it wrote in memory, which is the whole

thing a pipeline exists to avoid — and for a first program that never ends

on its own, the second would never start at all. So a thread moves bytes

across while both are running, and neither waits for the other to finish.

Each input is closed. A program reading until its input ends waits

forever if nothing closes it: the first program's at once because nothing

is feeding it, and the second's when the first has stopped writing.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • & borrows a value for this call instead of moving or copying it.
  • Names inside [ ] are type arguments, such as the item type held by a collection.
  • Result makes success and recoverable failure part of the function's type.

Back to Std.ProcessSearch related declarations