From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29773 invoked by alias); 26 Jun 2015 19:22:04 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35618 Received: (qmail 6797 invoked from network); 26 Jun 2015 19:22:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=ME/HsRXyFfZwduE7mEgA+rAM66rpQFIWD7dqeRRBF5M=; b=fu351Yv0IEb83G0vNp1PcJBOD8pwVmYPzSvQCPeRn4iIrBjhn6LGFfp95bV8Ba9rw+ ScSKTqxfqWBg8vahP1jFO3T2BLY49fLDmDqqEsRyVAtYXI5LgpWcllxDyrI6RQEwRPvZ N4B3dL0VknrdycVdESdadCVX45Ya1LX9YFHtl6+236xAd6jFn//dH5HPiU12HlvrJ3fd SnAuJ4/9GZkYO9jJVYHQ0jwzf9cYoYxH6qiNCSw9BJUphp2fOtSQsee3s8Fl3RXU89j5 hhHHCeBjZyHB3AviFNiaHieP4jINI3lerieJHltSp8zGbaXKSEstitrJWcVuEEmXGImO dLVQ== X-Gm-Message-State: ALoCoQkCATS0Cmk+EStyEcUhVJpcGkyR7Aa7cfRsjCXWo1qWaY07z/p1Tcze1YJgdc8SBch/4yp5 X-Received: by 10.202.58.215 with SMTP id h206mr2718020oia.23.1435346520616; Fri, 26 Jun 2015 12:22:00 -0700 (PDT) MIME-Version: 1.0 X-Originating-IP: [67.83.172.216] From: Patrick Palka Date: Fri, 26 Jun 2015 15:21:40 -0400 Message-ID: Subject: TRAPINT function set by parent shell causes subshell to misbehave To: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Hi, Consider the following testcase: $ (echo | less) $ TRAPINT() { } $ (echo | less) $ (TRAPINT() { }; echo | less) During the first execution of (echo | less) -- when a TRAPINT function is not yet defined -- notice how sending ^C does not kill the 'less' process or the subshell. During the second execution of (echo | less) -- after a TRAPINT function has been defined -- now sending ^C _does_ kill the subshell (and the 'less' process along with it) During the third execution of (echo | less) -- after a TRAPINT function has been defined in the parent shell and redefined in the subshell -- sending ^C no longer kills the subshell. So when a TRAPINT function is defined in the parent shell and not redefined in the subshell, then the subshell decides to exit when SIGINT is sent to it -- at least when the 'less' command is run. When (echo | less) is replaced with e.g. (nano) then ^C does not kill the subshell. Nonetheless I would expect that the 2nd execution always behaves like the 1st and 3rd executions.