diff --git a/contrib/cwrapper_perl.c b/contrib/cwrapper_perl.c index a3bacaae6..fc658b302 100644 --- a/contrib/cwrapper_perl.c +++ b/contrib/cwrapper_perl.c @@ -13,14 +13,17 @@ EXTERN_C void xs_init(pTHX) } int main (int argc, char **argv, char **env) -{ +{ + int exitstatus = 0; + PERL_SYS_INIT3(&argc, &argv, &env); my_perl = perl_alloc(); perl_construct(my_perl); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_parse(my_perl, xs_init, argc, argv, (char **)NULL); - perl_run(my_perl); + exitstatus = perl_run(my_perl); perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); + exit(exitstatus); }