changed to call hawk_rtx_cleario() before restoring SIGPIPE handler in bin/main.c

This commit is contained in:
hyung-hwan 2020-03-28 08:28:09 +00:00
parent a93beaaf55
commit e54537886c
3 changed files with 10 additions and 5 deletions

View File

@ -1221,6 +1221,11 @@ static HAWK_INLINE int execute_hawk (int argc, hawk_bch_t* argv[])
hawk_rtx_execwithbcstrarr(rtx, (const hawk_bch_t**)arg.icf.ptr, arg.icf.size);
#endif
/* clear unflushed io data - this is also done by hawk_rtx_close().
* but i restore the SIGPIPE handler to the default in unset_intr_run().
* any output after this restoration may cause the program to terminate for unhandled SIGPIPE */
hawk_rtx_cleario (rtx);
unset_intr_run ();
if (retv)

View File

@ -3356,7 +3356,7 @@ static int run_printf (hawk_rtx_t* rtx, hawk_nde_print_t* nde)
HAWK_ASSERT (head != HAWK_NULL);
v = eval_expression(rtx, head);
if (v == HAWK_NULL) goto oops_1;
if (HAWK_UNLIKELY(!v)) goto oops_1;
hawk_rtx_refupval (rtx, v);
vtype = HAWK_RTX_GETVALTYPE(rtx, v);
@ -5548,7 +5548,7 @@ static hawk_val_t* eval_binop_match0 (
int n;
out.ptr = hawk_rtx_getvaloocstr(rtx, left, &out.len);
if (out.ptr == HAWK_NULL) return HAWK_NULL;
if (HAWK_UNLIKELY(!out.ptr)) return HAWK_NULL;
n = hawk_rtx_matchvalwithoocs(rtx, right, &out, &out, HAWK_NULL, HAWK_NULL);
hawk_rtx_freevaloocstr (rtx, left, out.ptr);