   @moduledoc """
   Utilities for comparing build artifacts.
   """
-
-  @tmp_env_vars ~w(TMPDIR TMP TEMP)s
 
   @known_chunks ~w(
     abstract_code

    end
  end

  defp beam_diff(content1, content2) do
    tmp_file1 =
      content1
      |> humanize_beam_chunks()
      |> inspect(pretty: true, limit: :infinity)
      |> write_tmp()

    tmp_file2 =
      content2
      |> humanize_beam_chunks()
      |> inspect(pretty: true, limit: :infinity)
      |> write_tmp()

    file_diff(tmp_file1, tmp_file2)
  end

  defp file_diff(file1, file2) do
    {diff, _} = System.cmd("diff", [file1, file2])
    diff
  end

  defp humanize_beam_chunks(beam) do
    with {:ok, :beam_lib, chunks} <- :beam_lib.all_chunks(beam),
         chunk_ids = chunks |> Enum.map(fn {chunk_id, _binary} -> chunk_id end) |> Enum.sort(),
         {:ok, {_module, chunks}} <- :beam_lib.chunks(beam, chunk_ids) do
      Enum.map(chunks, &humanize_beam_chunk/1)
    else
      _ -> beam
    end
  end

  defp humanize_beam_chunk({chunk_id, _} = chunk) when chunk_id in @known_chunks do
    chunk
  end

  defp humanize_beam_chunk({chunk_id, binary}) do
    {chunk_id, :erlang.binary_to_term(binary)}
  end

  defp relative_paths(dir) do

    else
      diff =
        if String.ends_with?(file1, ".beam") do
          beam_diff(file1, content1, file2, content2)
        else
          file_diff(file1, file2)
        end
