aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/pending/sh.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index d0e73dc8..3ae66f62 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -2327,6 +2327,10 @@ static struct sh_process *run_command(void)
// Create new function context to hold local vars?
if (funk != TT.funcslen || (envlen && pp->arg.c) || TT.ff->blk->pipe) {
call_function();
+ if (funk != TT.funcslen) {
+ TT.ff->delete = pp->delete;
+ pp->delete = 0;
+ }
addvar(0, TT.ff); // function context (not source) so end_function deletes
locals = 1;
}