From c513ed4c23cc3e00e207699cd32201252cf8cc10 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 13 Feb 2022 20:39:51 +0900 Subject: [PATCH] util (ble/builtin/trap): fix a failure of setting the trap-handler exit status --- docs/ChangeLog.md | 1 + note.txt | 10 ++++++++++ src/util.sh | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 20458e1d..7a448d47 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -311,6 +311,7 @@ - global (`ble/builtin/*`): work around `set -eu` in NixOS initialization (reported by SuperSandro2000) `#D1743` 001c595 - util, edit, contrib: add support for `bash-preexec` (motivated by SuperSandro2000) `#D1744` e85f52c - util (`ble/builtin/trap`): fix resetting `$?` and `$_` (reported by SuperSandro2000) `#D1757` dfc6221 + - util (`ble/builtin/trap`): fix a failure of setting the trap-handler exit status (reported by SuperSandro2000) `#D1771` 0000000 - main: check `IN_NIX_SHELL` to inactivate ble.sh in nix-shell (suggested by SuperSandro2000) `#D1747` b4bd955 - main: force prompt-attach inside the nix-shell `rc` `#D1766` 0000000 - canvas: test the terminal for the sequence of clearing `DECSTBM` `#D1748` 4b1601d diff --git a/note.txt b/note.txt index 123151a9..b498cfe5 100644 --- a/note.txt +++ b/note.txt @@ -6089,6 +6089,16 @@ bash_tips 2022-02-13 + * util: EXIT trap を設定していると実際に exit する時に return に空文字列が渡される [#D1771] + https://github.com/akinomyoga/ble.sh/issues/175 + + これは明らかに最近書き直した trap handler 周りのの処理の問題である。と思っ + たが return を呼び出している箇所では特に空文字列が渡されそうなコードは見え + ない。再現はできているのでどうなっているか確認する事にする。 + + →分かった ble/util/setexit に渡す引数が空になっている。と思ったら単に typo + だった。というよりは変数名の変更漏れ。 + * [棄却] complete: ls ~/.c{onfig,1}/[TAB] としても候補が生成されない [#D1770] うーん。これは今迄ちゃんと候補が生成できるだろうと思っていたがそうでもない diff --git a/src/util.sh b/src/util.sh index 27506f77..378409d5 100644 --- a/src/util.sh +++ b/src/util.sh @@ -2117,7 +2117,7 @@ function ble/builtin/trap/invoke { case $_ble_trap_done in (done) _ble_builtin_trap_lastarg=$_ble_trap_lastarg - _ble_builtin_trap_postproc="ble/util/setexit $_ble_trap_lastext" ;; + _ble_builtin_trap_postproc="ble/util/setexit $_ble_trap_lastexit" ;; (break | continue) _ble_builtin_trap_lastarg=$_ble_trap_lastarg if ble/string#match "$_ble_trap_lastarg" '^-?[0-9]+$'; then