   end
 
   @doc ~S"""
-  Invokes the given `fun` and returns a tuple with its result
-  and the captured output.
-  It accepts the same arguments and options as `capture_io/2`.
+  Invokes the given `fun` and returns the result and captured output.
+
+  It accepts the same arguments and options as `capture_io/1`.
 
   ## Examples
 


  ## Options

    * `:capture_prompt` - Define if prompts (specified as arguments to
      `IO.get*` functions) should be captured. Defaults to `true`. For
      IO devices other than `:stdio`, the option is ignored.

    capture
  end

  @doc """
  Captures IO generated when evaluating `fun`.

  See `capture_io/1` for more information.
  """
  @spec capture_io(atom() | String.t() | keyword(), (() -> any())) :: String.t()
  def capture_io(device_input_or_options, fun)

  def capture_io(device, fun) when is_atom(device) and is_function(fun, 0) do
    {_result, capture} = with_io(device, fun)
    capture
  end

  def capture_io(input, fun) when is_binary(input) and is_function(fun, 0) do
    {_result, capture} = with_io(input, fun)
    capture
  end

  def capture_io(options, fun) when is_list(options) and is_function(fun, 0) do
    {_result, capture} = with_io(options, fun)
    capture
  end

  @doc """
  Captures IO generated when evaluating `fun`.

  See `capture_io/1` for more information.
  """
  @spec capture_io(atom(), String.t() | keyword(), (() -> any())) :: String.t()
  def capture_io(device, input_or_options, fun)

  def capture_io(device, input, fun)
      when is_atom(device) and is_binary(input) and is_function(fun, 0) do
    {_result, capture} = with_io(device, input, fun)
    capture
  end

  def capture_io(device, options, fun)
      when is_atom(device) and is_list(options) and is_function(fun, 0) do
    {_result, capture} = with_io(device, options, fun)
