fix exit status

This commit is contained in:
qgarnier 2017-08-11 16:44:20 +02:00
parent 5832e6a7eb
commit 54e9340f8c
1 changed files with 5 additions and 2 deletions

View File

@ -14,13 +14,16 @@ EXTERN_C void xs_init(pTHX)
int main (int argc, char **argv, char **env) int main (int argc, char **argv, char **env)
{ {
int exitstatus = 0;
PERL_SYS_INIT3(&argc, &argv, &env); PERL_SYS_INIT3(&argc, &argv, &env);
my_perl = perl_alloc(); my_perl = perl_alloc();
perl_construct(my_perl); perl_construct(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END; PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_parse(my_perl, xs_init, argc, argv, (char **)NULL); perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
perl_run(my_perl); exitstatus = perl_run(my_perl);
perl_destruct(my_perl); perl_destruct(my_perl);
perl_free(my_perl); perl_free(my_perl);
PERL_SYS_TERM(); PERL_SYS_TERM();
exit(exitstatus);
} }