-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]
Elixir 1.19.0-rc.0 (compiled with Erlang/OTP 28)
Operating system
Ubuntu 22.04
Current behavior
According to Mix documentation, it should be possible run a relative script with mix cmd, for example mix cmd priv/world.sh
in an alias. See:
Lines 273 to 291 in f089571
Another use case of aliases is to run Elixir scripts and shell | |
commands, for example: | |
# priv/hello1.exs | |
IO.puts("Hello One") | |
# priv/hello2.exs | |
IO.puts("Hello Two") | |
# priv/world.sh | |
#!/bin/sh | |
echo "world!" | |
# mix.exs | |
defp aliases do | |
[ | |
some_alias: ["hex.info", "run priv/hello1.exs", "cmd priv/world.sh"] | |
] | |
end |
We use this in some of our repositories in aliases, and the fix is simple enough for that use case
"cmd #{Path.absname("./priv/world.sh")}"
Expected behavior
I would expect mix cmd
to be able to run relative scripts in line with the documentation.
If this is not to be fixed, I would expect the documentation to be updated and for this to be logged as a deprecation in the 1.19 release changelog.
I am quite certain this was introduced by #13751 even though I have not confirmed it, but I can see in the System.cmd
code that relative paths are not allowed which throws the enoent
error that I am seeing.