Run shell commands in Elixir

Lahiru picture Lahiru · Mar 23, 2014 · Viewed 27.8k times · Source

I want to execute a program through my Elixir code. What is the method to call a shell command to a given string? Is there anything which isn't platform specific?

Answer

Overbryd picture Overbryd · Feb 1, 2015

Here is how you execute a simple shell command without arguments:

System.cmd("whoami", [])
# => {"lukas\n", 0}

Checkout the documentation about System for more information.