execv(script, argv);
/* Can't use ast_log since FD's are closed */
fprintf(stdout, "verbose \"Failed to execute '%s': %s\" 2\n", script, strerror(errno));
+ /* Special case to set status of AGI to failure */
+ fprintf(stdout, "failure\n");
fflush(stdout);
_exit(1);
}
break;
}
+ /* Special case for inability to execute child process */
+ if (*buf && strncasecmp(buf, "failure", 7) == 0) {
+ returnstatus = AGI_RESULT_FAILURE;
+ break;
+ }
+
/* get rid of trailing newline, if any */
if (*buf && buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = 0;
}
}
#endif
+ ast_replace_sigchld();
res = launch_script(argv[0], argv, fds, enhanced ? &efd : NULL, &pid);
if (res == AGI_RESULT_SUCCESS || res == AGI_RESULT_SUCCESS_FAST) {
int status = 0;
close(fds[1]);
if (efd > -1)
close(efd);
- ast_unreplace_sigchld();
}
+ ast_unreplace_sigchld();
ast_module_user_remove(u);
switch (res) {