Still a little problem with os_cmd("")

Nico Weling nico.weling@REDACTED
Thu Oct 11 13:20:23 CEST 2001


Hi Bengt,


> If I run your os_cmd() function with something that does not return
> sufficiently fast I get an exception. Unless I am mistaken 'mgetty'
> should run continually, and therefore always generate the exception.
> Or have I missed something?

Usualy you start mgetty at an specific runlevel an respawn it after you 
have received an fax. I want to start it by myself after I have see an 
ringing indication for a fax at the serial port. Then I start the 
os_cmd("mgetty...") and if it returns I know that the transmission of the
fax is terminated.

 
> PS: Could you please mention why 'Command' is constructed by calling
> binary_to_list( list_to_binary() )? Is it to remove escape sequences?

This (3>) should also work:

1> Cmd="mgetty /dev/ms1".
"mgetty /dev/ms1"

2> binary_to_list(list_to_binary(["sh -c '", Cmd,"' 2>&1"])).
"sh -c 'mgetty /dev/ms1' 2>&1"

3>  "sh -c '"++ Cmd ++"' 2>&1".
"sh -c 'mgetty /dev/ms1' 2>&1"


Regards,

Nico.



More information about the erlang-questions mailing list