Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
Date: Sat, 16 Apr 2016 00:59:41 -0700
From: frederik@ofb.net
To: zsh-workers@zsh.org
Subject: exec redirect prevents trap
Message-ID: <20160416075941.GA27994@ofb.net>
Reply-To: frederik@ofb.net
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.24 (2015-08-30)
Sender:  <frederik@ofb.net>
X-Seq: zsh-workers 38290

Dear Zsh Workers,

I have a script like this:

    #!/bin/zsh
    exec > >(tee -a /tmp/foo)
    trap "echo hi" INT TERM EXIT
    sleep 1d;

When I run it and hit ^C, it doesn't print anything. But when I remove
the "exec" line and do the same, it prints "hi". I would have expected
it to print "hi" both times.

- is this a bug?

- is there a way to get the trap to execute, even with the exec line
  present?

Thank you,

Frederick Eaton

