ex_cmd v0.3.0 ExCmd.Process View Source
Server to interact with external process
ExCmd.stream! should be preferred over this. Use this only if you need more control over the life-cycle of IO streams and OS process.
Link to this section Summary
Functions
Waits for the program to terminate.
Returns a specification to start this module under a supervisor.
Closes input stream. Which signal EOF to the program
Returns os pid of the command
Returns port_info
Return bytes written by the program to output stream.
Starts a process using cmd_with_args and with options opts
Returns status of the process. It will be either of :started, {:done, exit_status}
Kills the program
Writes iodata data to programs input streams
Link to this section Functions
Waits for the program to terminate.
If the program terminates before timeout, it returns {:ok, exit_status} else returns :timeout
Returns a specification to start this module under a supervisor.
See Supervisor in Elixir v1.6+.
Closes input stream. Which signal EOF to the program
Returns os pid of the command
Returns port_info
read(server, timeout \\ :infinity)
View Sourceread(pid(), non_neg_integer() | :infinity) :: {:ok, iodata()} | :eof | {:error, String.t()} | :closed
Return bytes written by the program to output stream.
This blocks until the programs write and flush the output
Starts a process using cmd_with_args and with options opts
cmd_with_args must be a list containing command with arguments. example: ["cat", "file.txt"].
Options
cd- the directory to run the command inenv- an enumerable of tuples containing environment key-value. These can be accessed in the external programlog- When set totrueodu logs and command stderr output are logged. Defaults tofalse
Returns status of the process. It will be either of :started, {:done, exit_status}
Kills the program
write(server, data, timeout \\ :infinity)
View Sourcewrite(pid(), iodata(), non_neg_integer() | :infinity) :: :ok | {:error, String.t()} | :closed
Writes iodata data to programs input streams
This blocks when the pipe is full