[asterisk-dev] Module to Asterisk function Compiler Issue question

Mike Myhre digium at aeisecure.com
Sun Aug 7 21:20:10 CDT 2011


> It's doing exactly what the exec() family of functions is supposed to
> do; replace the current executable image in the process with a
> different one and then execute it. If you want to execute the shell
> script in a child process, you have to fork() first... but you'd be
> better off to use ast_safe_system() which handles quite a few other
> nasty details for you as well.
I have one more question on the ast_safe_system() function and child 
processes. Is there a simple way to get output from a shell script? My 
CLI command has an open file descriptor I want to write to (a->fd) that 
should be open in my child process. I tried passing the file descriptor 
as a command argument and using it in a shell script, but I get the "Bad 
file descriptor" message on stderr output. I could write to a temporary 
file and read the file from my res module, but that isn't a very clean 
solution.

Is there a preferred way to get output from shell scripts to the 
asterisk CLI?

     Thanks.




More information about the asterisk-dev mailing list