Skip to content

Cannot list Android devices on macOS #3

@manhvu

Description

@manhvu

I cannot list my Android devices in macOS because missed timeout file for sh command:

My suggestion to fix that:

  # file: lib/mob_dev/discovery/android.ex
  defp run_adb(args) do
    cmd = Enum.join(["adb" | args], " ")

    supporter =
      case System.find_executable("timeout") do
        timeout when is_binary(timeout) ->
          "timeout 8"

        nil ->
          ""
      end

    case System.cmd("sh", ["-c", "#{supporter} #{cmd}"], stderr_to_stdout: true) do
      {output, 0} -> {:ok, output}
      {_output, 124} -> {:error, "adb timed out"}
      {output, _} -> {:error, output}
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions