mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +02:00
(invoke_main_func): Don't call exit here. Throws that
are only caught by scm_with_guile will bypass us and would cause scm_boot_guile to return erroneously. (scm_boot_guile): Expect scm_with_guile to return and call exit here, passing it an appropriate exit code.
This commit is contained in:
parent
e724644d45
commit
657e792903
1 changed files with 13 additions and 8 deletions
|
@ -339,6 +339,7 @@ static void *invoke_main_func(void *body_data);
|
|||
void
|
||||
scm_boot_guile (int argc, char ** argv, void (*main_func) (), void *closure)
|
||||
{
|
||||
void *res;
|
||||
struct main_func_closure c;
|
||||
|
||||
c.main_func = main_func;
|
||||
|
@ -346,7 +347,15 @@ scm_boot_guile (int argc, char ** argv, void (*main_func) (), void *closure)
|
|||
c.argc = argc;
|
||||
c.argv = argv;
|
||||
|
||||
scm_with_guile (invoke_main_func, &c);
|
||||
res = scm_with_guile (invoke_main_func, &c);
|
||||
|
||||
/* If the caller doesn't want this, they should exit from main_func
|
||||
themselves.
|
||||
*/
|
||||
if (res == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
else
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -365,13 +374,9 @@ invoke_main_func (void *body_data)
|
|||
*/
|
||||
SCM_ASYNC_TICK;
|
||||
|
||||
/* If the caller doesn't want this, they should exit from main_func
|
||||
themselves.
|
||||
/* Indicate success by returning non-NULL.
|
||||
*/
|
||||
exit (0);
|
||||
|
||||
/* never reached */
|
||||
return NULL;
|
||||
return (void *)1;
|
||||
}
|
||||
|
||||
scm_i_pthread_mutex_t scm_i_init_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue