[asterisk-dev] [Code Review]: SHELLEX() dialplan function
wdoekes
reviewboard at asterisk.org
Mon Oct 8 03:16:36 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).
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)
- wdoekes
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2061/#review7249
-----------------------------------------------------------
On Oct. 7, 2012, 3:41 p.m., Tilghman Lesher wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2061/
> -----------------------------------------------------------
>
> (Updated Oct. 7, 2012, 3:41 p.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/6cba5636/attachment.htm>
More information about the asterisk-dev
mailing list