Zsh Mailing List Archive
Messages sorted by:
Is there a way to put a timeout on a function?
- X-seq: zsh-workers 47354
- From: Rudi C <rudiwillalwaysloveyou@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Is there a way to put a timeout on a function?
- Date: Mon, 31 Aug 2020 19:29:49 +0430
- Archived-at: <https://zsh.org/workers/47354>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-08/CAE9z9A21U0Pye29dLAbeyYGW-V1pdHBr6vA%2BLBTho8wvU9%2BJqw%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-pj1-f47.google.com) smtp.remote-ip=188.8.131.52; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=rJlEBQo4CKReSrmEtcRS4sTyqeTzGCSr/ksyeJSNSQI=; b=lVOBwn5+lXZHTYeaJgfODhAbI/zxoRB7Yy/iE6BsUvwszzX/QIiAjyKclP+9dhUiTy WssksMjIrkoY0Q95dY16XQk6CYqYEF8xtGQ+zqAejZR8Vlykf+K/VrdAUYdCifzMV0dr xVTfwI51sjEIyiMni7TnjHrpNxUaNPImQrEtMD+sijUVEM/DDv37Y02SFLphNGX+Jvcr ao+2g5W/ovkPY0ImX911YZj+Pmi/fCCwYi2nZYBRyqBygDA/JdeSesUOXnHJOs3gTGSG H9OGlN+PebchtLyWSfzScEgMW3z8ZRxoiQ5yJVPH4a6N7LVxBUqjW7Ls9FXmKqGldU4c c6oQ==
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:email@example.com?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:firstname.lastname@example.org>
- List-post: <mailto:email@example.com>
- List-subscribe: <mailto:firstname.lastname@example.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:email@example.com?subject=unsubscribe%20zsh-workers>
- Sender: zsh-workers-request@xxxxxxx
I need to limit the execution time of arbitrary zsh functions. Is there a way to achieve this? I'm ok with just adding a time limit to all the external commands, but I do not know how to do that. (I don't want to manually prefix all my commands with the GNU timeout command.)
On a sidenote, I would also like to make the shell stop forcefully (like when a glob fails) if it doesn't find an external command. I thought maybe these two problems might have similar solutions. Is prexec viable for them? Does preexec even work for noninteractive scripts?
Messages sorted by: