Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute Shell Command Synchronously with Elixir/Erlang

Tags:

elixir

I want to execute a (slow) python script and I want my Elixir process to block until it's receives all the output from the script.

Are either Elixir's System.cmd/3 or Erlang's os:cmd/1 guaranteed to be synchronous? If not, is there some other way to make a synchronous os call?

like image 445
Valevalorin Avatar asked Jan 18 '16 00:01

Valevalorin


1 Answers

os:cmd

Executes Command in a command shell of the target OS, captures the standard output of the command and returns this result as a string. This function is a replacement of the previous unix:cmd/1; on a Unix platform they are equivalent.

This command is synchronous .

like image 51
BlackMamba Avatar answered Oct 20 '22 04:10

BlackMamba