Launch and executable file inside an Erlang Program

matthias <>
Sun Jul 1 23:15:51 CEST 2001


Salvador Alcaraz writes:
 > 
 > I think that Daniel Neri is right:
 > 
 > "...apparently os:cmd/1 still has problems with
 > binary output (on Unix)".
 > 
 > because, what does happen if execute an application with E/S display
 > instructions??
 > 
 > For example:
 > 
 >  1> os:cmd("pine").   

What should erlang do in this situation? Return the escape sequences
as a string when 'pine' exits. Not terribly useful. What you probably
want it to do is to take over the terminal and run 'pine' until the
user quits pine. This seems fraught with problems.

A cheesy (or clean, depending on your point of view) way to avoid the
problem on X is

  2> os:cmd("xterm -e pine"). 

Messing around with open_port({spawn, "pine"}, ...) and taking care of
the io seems impossibly hairy. Trying to get the sub-process to take
over the terminal (using {fd, 0, 1}) might be an option if you can
live without ^G and ^C and IO for other erlang processes, but I can't
figure out the details of getting this to fly (-noshell doesn't seem
to be enough).

Matthias



More information about the erlang-questions mailing list