pactl subscribe: immune to SIGPIPE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried "pactl subscribe" as even source for volume indicator, written
as shell script.

For minimal test I used this:

$ LANG=C pactl subscribe | stdbuf -oL awk '/change/ { print; exit }'

Full pipeline (simplified to show the issue):

$ env LANG=C pactl subscribe \
| stdbuf -oL awk '$2 == "'"'change'"'" { print "list-sinks" }' \
| "pacmd" \
| stdbuf -oL awk '
    BEGIN {
        parse_stage = 0
        sink_id = -1
    }

    /^sink / { sink_id = $2; next }

    # actual parsing for volume and mute
' |
{ ### adapter code ### } &

pid=$!
pulsemixer
kill $!

Ideally pipeline was to terminate by SIGPIPE chain from
terminated adapter sibling.

As workaround I wrap all pipeline to parenthesis with ampersand left
outside and use job control (doing "set -m" before pipeline start) to
kill all process group with "kill -- -$pid".

Well, to be fair, I have more reason for this workaround after trying
to pass controlled sink ID between two awks by making "pacmd"
controlled by first awk:

awk '{ print $5; print "list-sinks" | "pacmd" }' | awk .....
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux