From 7f079fe6549b3f11c9622a663035e1c0fb57dc8e Mon Sep 17 00:00:00 2001 From: Enzo Degraeve Date: Mon, 27 Jul 2026 09:32:46 +0200 Subject: [PATCH] fix(pm2): escape `+` in completion regex for BSD awk The `_pm2_id_names` completion passed `+--- ` as the regex argument to awk's sub(). An unescaped leading `+` is an illegal primary in BSD awk (macOS /usr/bin/awk), breaking `pm2 ` completion. GNU awk tolerates it, so the bug only showed on macOS/BSD. Escape it to `\+`. --- plugins/pm2/_pm2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2 index afe4ae0db..5f59185b6 100644 --- a/plugins/pm2/_pm2 +++ b/plugins/pm2/_pm2 @@ -314,7 +314,7 @@ _pm2_subcommands() { (( $+functions[_pm2_id_names] )) || _pm2_id_names() { local app_list=$(pm2 list -m) - local -a names=(${(@f)"$(echo $app_list | awk '/^\+---/{sub("+--- ", ""); print}')"}) + local -a names=(${(@f)"$(echo $app_list | awk '/^\+---/{sub("\\+--- ", ""); print}')"}) local -a ids=(${(@f)"$(echo $app_list | awk '/^pm2 id/{sub("pm2 id :", ""); print}')"}) if (( ${#ids} > 0 )); then