Skip to content
FutureBlitz

    Install

    Import std.os.process_child

    std.os.process_child

    Child, a program that a Command started, which runs beside this one: its Id, its piped streams, a Writer to its stdin and Readers of its stdout and stderr, and Wait, TryWait, and Kill, with the ExitStatus that says how it ended.

    std/os/process_child.fb

    Types

    ExitStatus struct

    Public Struct ExitStatus Implements Printable

    How a child ended: with the code it exited with, or by a signal, as Kill ends one.

    std/os/process_child.fb, line 29

    • Public ReadOnly Field Code: Int64? field #

      The code it exited with, which on Windows is from 0 to 4294967295, or Null when a signal ended it.

    • Public ReadOnly Field Signal: Int? field #

      The signal that ended it, as 9 for Kill, on Windows too, or Null when it exited.

    • Public Property Success: Bool property #

      Whether it exited with 0, which says it went well.

    • Public Method ToString(): String method #

      Its text, as a string interpolation like "{value}" shows it.

      Doc from std.core.interfaces.Printable.ToString.

    Child class

    Public Class Child

    A program that a Command started, which runs beside this one until it ends, whether or not this program waits for it. Letting go of it, and of its streams, closes its pipes, but doesn't end it.

    std/os/process_child.fb, line 60

    • Public ReadOnly Field Stdin: ChildInput? field #

      Its stdin, when the Command piped it, a Writer to what the child reads.

    • Public ReadOnly Field Stdout: ChildOutput? field #

      Its stdout, when the Command piped it, a Reader of what the child writes there.

    • Public ReadOnly Field Stderr: ChildOutput? field #

      Its stderr, when the Command piped it.

    • Public Property Id: Int64 property #

      The OS's number for its process.

    • Public Method Wait(): ExitStatus method #

      Waits for it to end, and gives how it did. Its stdin closes first, so a child that reads to its end doesn't wait for more.

    • Public Async Method WaitAsync(): ExitStatus method #

      Wait's Async twin, which waits on the main thread instead of blocking it.

    • Public Method TryWait(): ExitStatus? method #

      How it ended, or Null while it runs.

    • Public Method Kill() Throws IOError method #

      Ends it at once, unless it's ended already: by SIGKILL, or on Windows TerminateProcess, either way with Signal 9. Throws an IOError when the OS won't.

    ChildInput class

    Public Class ChildInput Implements Writer

    A child's stdin, which writes to what it reads. Bytes go to the child as they're written, and Write returns once they have.

    std/os/process_child.fb, line 117

    • Public Method Write(from: Buffer<UInt8>) Throws IOError method #

      Throws an IOError once the stream is closed, or the child has gone.

    • Public Async Method WriteAsync(from: Buffer<UInt8>) Throws IOError method #

      Write's Async twin, which waits on the main thread instead of blocking it.

      Doc from std.io.streams.Writer.WriteAsync.

    • Public Method Close() method #

      Closes it once what's written has gone, so the child reads to its end. Closing it again does nothing.

    ChildOutput class

    Public Class ChildOutput Implements Reader

    A child's stdout or stderr, which reads what it writes there, as it comes, until it ends or closes it.

    std/os/process_child.fb, line 156

    • Public Method Read(into: Buffer<UInt8>): Int64 Throws IOError method #

      Reads up to into.Count bytes into the start of into, and gives how many it read: one at least, or 0 once the stream has ended, or for an empty Buffer.

      Doc from std.io.streams.Reader.Read.

    • Public Async Method ReadAsync(into: Buffer<UInt8>): Int64 Throws IOError method #

      Read's Async twin, which waits on the main thread instead of blocking it. One that can only block reads with Read.

      Doc from std.io.streams.Reader.ReadAsync.

    Report an issue with this page or with FutureBlitz on GitHub.