Compare commits

...

3 Commits

Author SHA1 Message Date
Scott Baxter 33c56714df
Merge 2885c1cf35 into 7ff836131a 2026-03-11 11:49:06 +01:00
Kevin Ji 7ff836131a
fix(gcloud): prevent gcloud CLI from hanging (#2935)
If the `gcloud` command is interactive (e.g. asks to install a component, or needs an update), the current code will hang forever, and is uninterruptible as `INT` is being swallowed.

Fix this with `</dev/null` and `--quiet`.
2026-03-11 09:09:44 +08:00
Scott Baxter 2885c1cf35 fix: Worker no longer leaves defunct pid on macOS 2025-05-03 21:41:05 -05:00
2 changed files with 6 additions and 2 deletions

View File

@ -4716,7 +4716,9 @@ _p9k_gcloud_prefetch() {
if ! _p9k_cache_stat_get $0 ${CLOUDSDK_CONFIG:-~/.config/gcloud}/configurations/config_$P9K_GCLOUD_CONFIGURATION; then if ! _p9k_cache_stat_get $0 ${CLOUDSDK_CONFIG:-~/.config/gcloud}/configurations/config_$P9K_GCLOUD_CONFIGURATION; then
local pair account project_id local pair account project_id
pair="$(gcloud config configurations describe $P9K_GCLOUD_CONFIGURATION \ pair="$(gcloud config configurations describe $P9K_GCLOUD_CONFIGURATION \
--format=$'value[separator="\1"](properties.core.account,properties.core.project)')" --quiet \
--format=$'value[separator="\1"](properties.core.account,properties.core.project)' \
</dev/null)"
(( ! $? )) && IFS=$'\1' read account project_id <<<$pair (( ! $? )) && IFS=$'\1' read account project_id <<<$pair
_p9k_cache_stat_set "$account" "$project_id" _p9k_cache_stat_set "$account" "$project_id"
fi fi

View File

@ -19,7 +19,9 @@ function _p9k_worker_main() {
# usage: _p9k_worker_async <work> <callback> # usage: _p9k_worker_async <work> <callback>
function _p9k_worker_async() { function _p9k_worker_async() {
local fd async=$1 local fd async=$1
sysopen -r -o cloexec -u fd <(() { eval $async; } && print -n '\x1e') || return (print -n '\x1e' &)
pid=$!
wait $pid || return 1
(( ++_p9k_worker_inflight[$_p9k_worker_request_id] )) (( ++_p9k_worker_inflight[$_p9k_worker_request_id] ))
_p9k_worker_fds[$fd]=$_p9k_worker_request_id$'\x1f'$2 _p9k_worker_fds[$fd]=$_p9k_worker_request_id$'\x1f'$2
} }