execute winded handlers when exit is called

This commit is contained in:
Yuichi Nishiwaki 2013-12-09 13:51:34 +09:00
parent bea04325e5
commit d21db9ae81
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@ pic_system_exit(pic_state *pic)
{
pic_value v;
int argc, status = EXIT_SUCCESS;
struct pic_block *blk;
argc = pic_get_args(pic, "|o", &v);
if (argc == 1) {
@ -41,6 +42,12 @@ pic_system_exit(pic_state *pic)
}
}
blk = pic->blk;
while (blk) {
pic_apply_argv(pic, blk->out, 0);
blk = blk->prev;
}
exit(status);
}