[erlang-questions] Run external program with arguments

Alexander Zhukov azhukov@REDACTED
Wed Nov 14 15:37:14 CET 2007


Sorry, I forget how to write to mailing lists and sent two private
replies ;)

In summary, os:cmd does not allow to communicate with called program,
and open_port does not allow to specify arguments to run program with.

As a more general approach than script I decided to write simple C++
program which will read from cin program name and arguments and then
will execv. I do like this approach more than script.

>>>>> Yerl  (Y) writes:

 Y> Hi !  Look here :

 Y> http://easyerl.blogspot.com/search/label/execution
 Y> http://easyerl.blogspot.com/search/label/process

 Y> There's a lot of good stuffs like using "ibTRE" regular expression
 Y> engin ...  Good luck

 Y> cheers Y.

 Y> Alexander Zhukov a écrit :
 >> Hi!
 >> 
 >> Is there a way to run an external program from Erlang program with
 >> arguments?
 >> 
 >> I like to be able to write something like this:
 >> 
 >> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c",
 >> "file", "-d"]}]),
 >> 
 >> but so far I can't find a way to run a program with arguments.
 >> 
 >> Yes, I know I can write a wrapper script but I do not like such an
 >> approach.
 >> 
 >> 


-- 
Alexander Zhukov



More information about the erlang-questions mailing list