Fix SIGPIPE under pipefail in status (awk-exit and head -1 pipelines)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
28allday 2026-07-03 19:27:21 +01:00
parent 4d30b9d55a
commit b0374f87e7

View file

@ -117,7 +117,8 @@ cmd_unpair() {
cmd_status() { cmd_status() {
local iface udid name local iface udid name
if udid=$(idevice_id -l 2>/dev/null | head -1) && [[ -n $udid ]]; then udid=$(idevice_id -l 2>/dev/null | head -1 || true)
if [[ -n $udid ]]; then
name=$(ideviceinfo -k DeviceName 2>/dev/null || echo "unknown") name=$(ideviceinfo -k DeviceName 2>/dev/null || echo "unknown")
ok "iPhone connected over USB: $name" ok "iPhone connected over USB: $name"
if idevicepair validate >/dev/null 2>&1; then if idevicepair validate >/dev/null 2>&1; then
@ -131,7 +132,7 @@ cmd_status() {
if iface=$(tether_iface); then if iface=$(tether_iface); then
local state addr local state addr
state=$(networkctl status "$iface" 2>/dev/null | awk '/State:/{print $2; exit}') state=$(networkctl status "$iface" 2>/dev/null | awk '/State:/{print $2; exit}' || true)
ok "Tether interface: $iface ($state)" ok "Tether interface: $iface ($state)"
addr=$(ip -4 -br addr show "$iface" | awk '{print $3}') addr=$(ip -4 -br addr show "$iface" | awk '{print $3}')
if [[ -n $addr ]]; then if [[ -n $addr ]]; then