PreviousUpNext

14.4.77  Spawn

The standard library Spawn api defines access to functionality for conveniently firing up subprocesses. This functionality is built on top of Posix_1003_1b fork functionality; it encapsulates most of the work required to do a useful fork of a subprocess.

The Spawn api is implemented by the spawn package.

The Spawn api source code is in src/lib/std/src/posix/spawn.api.

See also: Posix_1003_1b.

See also: Threadkit_Spawn.

The above information is manually maintained and may contain errors.

api {
    Process (X, Y, Z);
    Exit_Status 
      = W_EXITED
      | W_EXITSTATUS one_byte_unt::Unt
      | W_SIGNALED ?.posix_signal::Signal
      | W_STOPPED ?.posix_signal::Signal;
    from_status : Int -> Exit_Status;
    Spawn_Option 
      = REDIRECT_STDERR_IN_CHILD Bool
      | REDIRECT_STDERR_TO_STDOUT_IN_CHILD Bool
      | REDIRECT_STDIN_IN_CHILD Bool
      | REDIRECT_STDOUT_IN_CHILD Bool
      | WITH_ENVIRONMENT List(String );
    spawn_process : {arguments:List(String ),  executable:String, 
                     options:List(Spawn_Option )}
                    -> Process((X, Y, Z) );
    fork_process : List(Spawn_Option ) -> Null_Or(Process((X, Y, Z) ) );
    bash : String -> String;
    get_stdin_to_child_as_text_stream : Process((Output_Stream, X, Y) ) -> Output_Stream;
    get_stdin_to_child_as_binary_stream : Process((binary_io::Output_Stream, X, Y) )
                                          -> binary_io::Output_Stream;
    get_stdout_from_child_as_text_stream : Process((X, Input_Stream, Y) ) -> Input_Stream;
    get_stdout_from_child_as_binary_stream : Process((X, binary_io::Input_Stream, Y) )
                                             -> binary_io::Input_Stream;
    get_stderr_from_child_as_text_stream : Process((X, Y, Input_Stream) ) -> Input_Stream;
    get_stderr_from_child_as_binary_stream : Process((X, Y, binary_io::Input_Stream) )
                                             -> binary_io::Input_Stream;
    process_id_of : Process((X, Y, Z) ) -> Int;
    text_streams_of : Process((Output_Stream, Input_Stream, Input_Stream) )
                      -> {stdin_to_child:Output_Stream, 
                          stdout_from_child:Input_Stream};
    reap : Process((X, Y, Z) ) -> Int;
    kill : (Process((X, Y, Z) ) , ?.posix_signal::Signal) -> Void;
    exit : one_byte_unt::Unt -> X;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext