From d21db9ae81c3cbf31df0c22653310f009ede72d9 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 9 Dec 2013 13:51:34 +0900 Subject: [PATCH] execute winded handlers when exit is called --- src/system.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/system.c b/src/system.c index 097389e0..ab87d58f 100644 --- a/src/system.c +++ b/src/system.c @@ -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); }