mirror of
https://github.com/zplug/zplug
synced 2025-04-30 13:17:57 +02:00
This is because grep may not be able to correctly distinguish tab characters. In order to solve this, added a ltsv parser written by awk. - Fix #326 (see also second commit in P-R #344), fix #348 - Add `__zplug::utils::awk::ltsv function`
42 lines
752 B
Bash
42 lines
752 B
Bash
__zplug::job::process::is_running()
|
|
{
|
|
local job
|
|
|
|
for job in "$argv[@]"
|
|
do
|
|
[[ $job == "" ]] && return 1
|
|
if kill -0 "$job" &>/dev/null; then
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
__zplug::job::process::get_status_code() {
|
|
local repo="${1:?}" target="${2:?}"
|
|
|
|
if [[ ! -f $_zplug_log[$target] ]]; then
|
|
# TODO
|
|
return 1
|
|
fi
|
|
|
|
cat "$_zplug_log[$target]" \
|
|
| __zplug::utils::awk::ltsv \
|
|
'key("repo")=="'"$repo"'"{print key("status")}'
|
|
|
|
return $status
|
|
}
|
|
|
|
__zplug::job::process::kill() {
|
|
local pid="${1:?}"
|
|
|
|
if ! __zplug::job::process::is_running "$pid"; then
|
|
# TODO
|
|
return $status
|
|
fi
|
|
|
|
kill -9 $pid &>/dev/null
|
|
return $status
|
|
}
|