Skip to content

Commit

Permalink
util (conditional-sync): fix the signal determination (fixup a4a779e)
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jun 2, 2022
1 parent a4a779e commit 46f5c13
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contrib
Submodule contrib updated 1 files
+1 −1 config/execmark.bash
4 changes: 2 additions & 2 deletions docs/ChangeLog.md
Expand Up @@ -98,7 +98,7 @@
- sabbrev: support options `-r` and `--reset` to remove entries `#D1790` 29b8be3
- util (blehook): support `hook!=handler` and `hook+-=handler` `#D1791` 0b8c097
- prompt: escape control characters in `\w` and `\W` `#D1798` 8940434 a9551e5
- prompt: fix wrongly escaped UTF-8 chars in `\w` and `\W` `#D1806` XXXXXXX
- prompt: fix wrongly escaped UTF-8 chars in `\w` and `\W` `#D1806` d340233

## Changes

Expand Down Expand Up @@ -344,7 +344,7 @@
- global: work around bash-3.0 bug that single quotas remains for `"${v-$''}"` `#D1774` 9b96578
- util: work around old `vte` not supporting `DECSCUSR` yet setting `TERM=xterm` (reported by dongxi8) `#D1785` 70277d0
- progcomp: work around the cobra V2 description hack (reported by SuperSandro2000) `#D1803` 71d0736
- complete: work around blocking `_scp_remote_files` and `_dnf` (reported by iantra) `#D1807` XXXXXXX
- complete: work around blocking `_scp_remote_files` and `_dnf` (reported by iantra) `#D1807` a4a779e XXXXXXX

## Internal changes and fixes

Expand Down
18 changes: 18 additions & 0 deletions note.txt
Expand Up @@ -1809,6 +1809,21 @@ bash_tips
ToDo
-------------------------------------------------------------------------------

2022-06-02

* bash-4.4 crash (reported by notmike-5)
https://github.com/akinomyoga/ble.sh/issues/195

source した瞬間に crash するという事だろうか?

一方で別の問題を発見した。bash-completion scp の補完で 4.4 がcrash する。こ
れは ble.sh なしでも再現する。また、bash-5.0 以降では発生しない。
bash-4.2..4.4 の全てで再現する。これは後で bash-completion の側で対処が必要。

2022-05-12

* isearch: 現在行と全く同じ内容の行には一致しないというオプション

2022-04-13

* bash が `vi-edit-and-execute-command' を追加している。
Expand Down Expand Up @@ -6365,6 +6380,9 @@ bash_tips
る必要がある。うーん。一応 bash-completion に関しては 124 により一旦制御
を返すので介入はできる気がする。

2022-06-02 conditional-sync のミスを push する。暫く手元に置いていたがずっ
とこのままにしておくのは好ましくない。

2022-05-01

* 日本語を含むディレクトリに入ると化けてしまう事に気づいた [#D1806]
Expand Down
28 changes: 25 additions & 3 deletions src/util.sh
Expand Up @@ -4098,18 +4098,40 @@ function ble/util/conditional-sync/.kill {
fi

if [[ :$__opts: == *:SIGKILL:* ]]; then
builtin kill "${kill_pids[@]}" &>/dev/null
else
builtin kill -9 "${kill_pids[@]}" &>/dev/null
else
builtin kill "${kill_pids[@]}" &>/dev/null
fi
} &>/dev/null

## @fn ble/util/conditional-sync command [condition weight opts]
## Evaluate COMMAND and kill it when CONDITION becomes unsatisfied before
## COMMAND ends.
##
## @param[in] command
## The command that is evaluated in a subshell
## @param[in,opt] condition
## The command to test the condition to continue to run the command. The
## default condition is "! ble/decode/has-input".
## @param[in,opt] weight
## The interval of checking CONDITION in milliseconds. The default is
## "100".
## @param[in,opt] opts
## progressive-weight
## A colon-separated list of the following fields to control the detailed
## behavior:
##
## @opt progressive-weight
## The interval of checking CONDITION is gradually increased and stops
## at the value specified by WEIGHT.
## @opt timeout=TIMEOUT
## When this is specified, COMMAND is unconditionally terminated when
## it does not end until the time specified by TIMEOUT in milliseconds
## @opt killall
## Kill also all the children and descendant processes. When this is
## unspecified, only the subshell used to run COMMAND is killed.
## @opt SIGKILL
## The processes are killed by SIGKILL. When this is unspecified, the
## processes are killed by SIGTERM.
##
function ble/util/conditional-sync {
local __command=$1
Expand Down

0 comments on commit 46f5c13

Please sign in to comment.