Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exec'ing $0 in traps
- X-seq: zsh-users 22474
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Andre Albsmeier <Andre.Albsmeier@xxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: exec'ing $0 in traps
- Date: Fri, 17 Feb 2017 12:02:19 -0800
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=resent-from:resent-message-id:resent-date:resent-to:from:message-id :date:in-reply-to:comments:references:to:subject:mime-version; bh=KswMU2wvEo2vr96JLxyw64MqUw3xaPpsUkhDEjXm9lw=; b=CYnv/vGv1IOckCNnwHo2iF6K3uOubwWIhcxYvmdzf7odJioYpjADnVbaighmyXredz A1y33eQrBN0ZhuPq628wQ7i5IczdSjfnHP+tPEa1Y2ctrCxmdRbMzSBTqzUq9BC7hMiv 9dJ1hXKFF3H0nAc655qztj3CL/Nvwi7yMQPxER5YLy5Bnsyyxfx5syPyfeVO/+4nqmKd RJIsMNF4tnbGL+mFoRzCCyb1ujaDZjn2YtP/vBD99NnYeu48HRB6ZNsnf8wIz4Yo1Qx5 EAgkfwGr6tZInKEMR8jmMxBtL/DPizTctlWHKkeGsWZOnSR5V+xelHmRJBnjq4b4uw64 ieWg==
- In-reply-to: <20170217081604.GA59728@bali>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20170217081604.GA59728@bali>
On Feb 17, 9:16am, Andre Albsmeier wrote:
}
} #!/bin/zsh
}
} echo started
} trap 'echo trapped; exec "$0"' 1
}
} echo $$ > /tmp/blafasel
}
} while read line; do
} echo line $line
} done
Some combination of the "read" builtin plus calling "exec" from inside
the signal handler is causing the HUP signal to remain blocked across
the "exec" -- and re-installing the trap doesn't unblock it.
If I replace the read-loop with
sleep 3
kill -1 $$
then the process restarts itself every 3 seconds as expected.
So, you aren't doing anything explicitly wrong.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author