X-Git-Url: https://git.draconx.ca/gitweb/mpdhacks.git/blobdiff_plain/4fec499ce726a2dad91c05e2cd69566b31d9d15a..9b02bdda42565b687ecefe63b106118088f1c505:/MPDHacks.pm diff --git a/MPDHacks.pm b/MPDHacks.pm index 0f5026e..7da3b06 100644 --- a/MPDHacks.pm +++ b/MPDHacks.pm @@ -115,4 +115,14 @@ sub exec { print $sock "$cmd\n"; } +# Submit a command to the MPD server and wait for it to complete. +# Intended for simple cases where the command output is unneeded. +sub run { + MPD::exec(@_); + while (<$sock>) { + last if (/^OK/); + die($_) if (/^ACK/); + } +} + 1;