bend-stdio-pipes Releases (2): 0.2.0.0 0xb78514d61afc4e796fd06df1830e0f32 indexed https://jend.leeeet.dev/files.txt?path=bend-stdio-pipes@0.2.0.0 0.1.0.0 0x5533bfabb087cd4e9415732799f27f8f unindexed https://jend.leeeet.dev/files.txt?path=bend-stdio-pipes@0.1.0.0 Definitions (10): Impl.stdin (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=stdin) # This program's stdin. A File owns its descriptor: ask for it once. def stdin() -> IO(File): Impl.open (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=open) # Start a program, with its stdin and stdout as pipes: its process id, the File that writes its # stdin, and the File that reads its stdout. Its stderr is ours. Closing the stdin File gives it # EOF; nothing waits for it to exit. On JS, it runs on Bun on Linux and macOS only; elsewhere it # fails with ENOSYS. def open( program: String, args: List ) -> IO(Result<&1, &1, U32 & String, U32 & (File & File)>): Impl.kill (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=kill) # Kills the program that open started with pid, unless it has ended: then it fails with ESRCH (3). # It never kills a program that open did not start, though the system gives an ended program's pid # to another one. def kill(pid: U32) -> IO(Result<&1, &1, U32 & String, Unit>): Impl.read_line.peeked (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=read_line.peeked) # A line with no LF that ends the input is the last line; one that does not is too long. def read_line.peeked( next: File & Result<&1, &1, U32 & String, String>, text: String ) -> File & Result<&1, &1, U32 & String, Maybe>: Impl.read_line.unended (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=read_line.unended) # The line of a piece that ends with its LF: the piece without the LF, and the CR before it, if any. def read_line.unended(+piece: String) -> String: Impl.read_line.if (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=read_line.if) def read_line.if( file: File, ended: Bool, piece: String ) -> IO(File & Result<&1, &1, U32 & String, Maybe>): Impl.read_line.got (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=read_line.got) def read_line.got( got: File & Result<&1, &1, U32 & String, String> ) -> IO(File & Result<&1, &1, U32 & String, Maybe>): Impl.read_line (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=read_line) # The next line of file, as it comes, without its LF or CRLF; None at the end of the file. def read_line(file: File, max: U32) -> IO(File & Result<&1, &1, U32 & String, Maybe>): Impl.write_lines.text (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=write_lines.text) def write_lines.text(lines: List) -> String: Impl.write_lines (https://jend.leeeet.dev/definition.txt?path=bend-stdio-pipes@0.2.0.0/impl.bend&name=write_lines) # Writes each line to file, with its LF. def write_lines(file: File, lines: List) -> IO(File & Result<&1, &1, U32 & String, Unit>):