From watching this Jose video https://youtu.be/suOzNeMJXl0?t=466 at minute 7:46 I see him opening the source file for Tuple.to_list
from an iex
session, but if a try to the same I get an error saying the file is not available:
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 iex 130 ↵
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> open Tuple.to_list
Could not open: "/usr/local/lib/elixir/bin/../lib/elixir/lib/tuple.ex". File is not available.
iex(2)>
or with the docker official image:
docker run --rm -it elixir
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> open Tuple.to_list
Could not open: "/usr/local/lib/elixir/bin/../lib/elixir/lib/tuple.ex". File is not available.
If check the path in iex
:
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 iex
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :code.which Tuple
'/usr/local/lib/elixir/bin/../lib/elixir/ebin/Elixir.Tuple.beam'
iex(2)>
We get a different path and file name. Why is this happening?
If we drop to bash shell the file is indeed in same path reported by :code.which Tuple
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 bash
root@ff317b8171cc:/# ls -al /usr/local/lib/elixir/lib/elixir/ebin/Elixir.Tuple.beam
-rw-r--r-- 1 root root 3564 Apr 27 12:14 /usr/local/lib/elixir/lib/elixir/ebin/Elixir.Tuple.beam
So for some reason the function open
doesn’t work in the same way as seen in the Jose video for the Elixir core, but if I try to open a file im my project it just works. I am wondering if this is anything related to be running Elixir installed in a MAC, that may use different folder structures to install Elixir when compared with Linux?
I also have the same issue when building docker images with Erlang and Elixir directly from Github releases.
To note that I don’t have Elixir installed in my host machine, because I never install any programming language or toolling in my host. Everything I can, runs from docker containers.
So I am curious if someone with Elixir installed in the Linux host is able to run open Tuple.to_list
sucessefully?