Ocamlnet 3 Reference Manual : Netchannels.output_command

# Class Netchannels.output_command

    class output_command : ?onclose:unit -> unit -> string -> out_obj_channel

Runs the command with `/bin/sh`, and data written to the channel is piped to stdin of the command.

The method `pos_out` returns the number of written octets.

When `close_out` is invoked, the subprocess is `wait`ed for. If the process exits with code 0, the method returns normally. Otherwise, the exception `Command_failure` is raised. (The channel is closed even if this exception is raised.)

`onclose` : this function is called when the `close_out` method is invoked, just after the underlying descriptor has been closed.