diff --git a/Makefile.am b/Makefile.am index d55facf..a4e5a1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -214,6 +214,7 @@ FULL_TESTS = \ tests/50-redirect-sed.sh \ tests/50-redirect-space.sh \ tests/50-redirect-in-out.sh \ + tests/50-redirect-clobber.sh \ tests/60-function.sh \ tests/60-function-at.sh \ tests/60-subst.sh \ diff --git a/gash/eval.scm b/gash/eval.scm index 50fce35..28ec5d3 100644 --- a/gash/eval.scm +++ b/gash/eval.scm @@ -1,5 +1,6 @@ ;;; Gash -- Guile As SHell -;;; Copyright © 2018 Timothy Sample +;;; Copyright © 2018, 2019 Timothy Sample +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of Gash. ;;; @@ -52,7 +53,10 @@ (_ `(,op ,fd ,field))))) (define (exp->thunk exp) - (lambda () (eval-sh exp))) + ;; XXX: See comment in `exps->thunk'. + (if exp + (lambda () (eval-sh exp)) + noop)) (define (exps->thunk exps) ;; XXX: It probably makes more sense to exclude '#f' expressions at diff --git a/tests/50-redirect-clobber.sh b/tests/50-redirect-clobber.sh new file mode 100644 index 0000000..8ed65e3 --- /dev/null +++ b/tests/50-redirect-clobber.sh @@ -0,0 +1,4 @@ +echo foo > /tmp/bar$$ +cat /tmp/bar$$ +> /tmp/bar$$ +cat /tmp/bar$$ diff --git a/tests/50-redirect-clobber.stdout b/tests/50-redirect-clobber.stdout new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/50-redirect-clobber.stdout @@ -0,0 +1 @@ +foo