         {:win32, _} ->
           base = Path.rootname(exec)
           if File.regular?(base), do: base, else: exec
+
         _ ->
           exec
       end

  end

  defp parse_argv(["+elixirc" | t], config) do
    parse_compiler t, config
  end

  defp parse_argv(["+iex" | t], config) do
    parse_iex t, config
  end

  defp parse_argv(["-S", h | t], config) do

  @doc false
  def process_commands(config) do
    results = Enum.map(Enum.reverse(config.commands), &process_command(&1, config))
    errors = for {:error, msg} <- results, do: msg
    Enum.reverse(config.errors, errors)
  end

  @doc false
  def format_error(kind, reason, stacktrace) do
    {blamed, stacktrace} = Exception.blame(kind, reason, stacktrace)

    iodata =
      case blamed do
        %FunctionClauseError{} ->
          formatted = Exception.format_banner(kind, reason, stacktrace)
          padded_blame = pad(FunctionClauseError.blame(blamed, &inspect/1, &blame_match/2))
          [formatted, padded_blame]

        _ ->
          Exception.format_banner(kind, blamed, stacktrace)
      end

    [iodata, ?\n, Exception.format_stacktrace(prune_stacktrace(stacktrace))]
  end

