[asterisk-dev] [Code Review]: SHELLEX() dialplan function

Tilghman Lesher reviewboard at asterisk.org
Mon Oct 8 10:31:50 CDT 2012



> On Oct. 8, 2012, 2:43 a.m., wdoekes wrote:
> > /trunk/funcs/func_shell.c, lines 155-157
> > <https://reviewboard.asterisk.org/r/2061/diff/4/?file=31770#file31770line155>
> >
> >     if (waitpid(pid, &status, 0) > 0 && res == 0 && WIFEXITED(status)) {
> >         snprintf(sstatus, sizeof(sstatus), "%3d", WEXITSTATUS(status));
> >     
> >     
> >     Otherwise you get status 1024 => "102" (0x400) for e.g. return '4' (at least on my linux here).
> 
> wdoekes wrote:
>     Or better:
>     
>                     if (WIFEXITED(status)) {
>                             snprintf(sstatus, sizeof(sstatus), "%3d", WEXITSTATUS(status));
>                     } else if (WIFSIGNALED(status)) {
>                             snprintf(sstatus, sizeof(sstatus), "%3d", -WTERMSIG(status));
>                     }
>     
>     (otherwise a killed processed would get status 000)

Added, although in a slightly different way.


> On Oct. 8, 2012, 2:43 a.m., wdoekes wrote:
> > /trunk/funcs/func_shell.c, line 272
> > <https://reviewboard.asterisk.org/r/2061/diff/4/?file=31770#file31770line272>
> >
> >     At least two tabs for this line continuation? Same in load_module().

Changed.


- Tilghman


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2061/#review7249
-----------------------------------------------------------


On Oct. 8, 2012, 10:31 a.m., Tilghman Lesher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2061/
> -----------------------------------------------------------
> 
> (Updated Oct. 8, 2012, 10:31 a.m.)
> 
> 
> Review request for Asterisk Developers and Kevin Fleming.
> 
> 
> Summary
> -------
> 
> Following a discussion about capturing the return value as well as the output of a command, I came up with this.
> 
> 
> Diffs
> -----
> 
>   /trunk/funcs/func_curl.c 374635 
>   /trunk/funcs/func_odbc.c 374635 
>   /trunk/funcs/func_realtime.c 374635 
>   /trunk/funcs/func_shell.c 374635 
>   /trunk/funcs/func_strings.c 374635 
> 
> Diff: https://reviewboard.asterisk.org/r/2061/diff
> 
> 
> Testing
> -------
> 
> Compile testing only
> 
> 
> Thanks,
> 
> Tilghman
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121008/0691ac54/attachment.htm>


More information about the asterisk-dev mailing list