System.cmd cd option error

I’m running System.cmd("mix deps.get", [], cd: target_path) to automate getting dependencies as part of a project setup. I have verified that target_path is the correct file path. I am still getting an “Erlang error: :enoent” suggesting the mix.exs file at target_path/mix.exs is not found. I have verified that the file exists at that location. What do I need to do differently? The only thing I can think of is that when I looked at System.cmd("pwd", [], cd: target_path) the output included a newline character that target_path does not have. Is the cd option somehow throwing that on the end?

System.cmd expects the command to be presented separately from arguments - so it should be:

System.cmd("mix", ["deps.get"], cd: target_path)
2 Likes