   defp do_capture_io(device, options, fun) do
     input = Keyword.get(options, :input, "")
     {:ok, string_io} = StringIO.open(input)
+
     case ExUnit.CaptureServer.device_capture_on(device, string_io) do
       {:ok, ref} ->
         try do

        after
          ExUnit.CaptureServer.device_capture_off(ref)
        end
      {:error, :no_device} ->
        _ = StringIO.close(string_io)
        raise "could not find IO device registered at #{inspect device}"
      {:error, :already_captured} ->
        _ = StringIO.close(string_io)
        raise "IO device registered at #{inspect device} is already captured"
    end
  end


    do_capture_io(map_dev(device), options, fun)
  end

  defp map_dev(:stdio), do: :standard_io
  defp map_dev(:stderr), do: :standard_error
  defp map_dev(other), do: other

  defp do_capture_io(:standard_io, options, fun) do
    prompt_config = Keyword.get(options, :capture_prompt, true)
