summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-08-12 15:27:04 +0200
committerRasmus Steinke <rasi@xssn.at>2017-08-12 15:27:04 +0200
commit125cc17f61a5f382164e3364850c9e4ef0645d3b (patch)
tree5d7c6e5822cc84d6cac6f49699e19059aba621fd
parent34cadbba822a82840e4ef6807499b24eb0c086fa (diff)
downloadperl-app-clerk-125cc17f61a5f382164e3364850c9e4ef0645d3b.tar.gz
perl-app-clerk-125cc17f61a5f382164e3364850c9e4ef0645d3b.tar.xz
close mpd socket properly
-rwxr-xr-xclerk4
1 files changed, 4 insertions, 0 deletions
diff --git a/clerk b/clerk
index e1d4d18..582afde 100755
--- a/clerk
+++ b/clerk
@@ -228,6 +228,8 @@ sub random {
my @queue_cmd = ('tmux', 'findw', '-t', 'music', 'queue');
my @action_items = ("Album\n", "Tracks\n", "Settings\n");
my $action = backend_call(\@action_items, "1,2,3", "cancel");
+ try { $mpd->close(); };
+ $mpd->{socket}->close;
if ($action eq "Album\n") {
$mpd->clear();
my @album_artists = $mpd->list('albumartist');
@@ -268,6 +270,8 @@ sub do_action {
my ($in, $context) = @_;
my @action_items = ("Add\n", "Replace\n");
my $action = backend_call(\@action_items);
+ try { $mpd->close(); };
+ $mpd->{socket}->close;
if ($action eq "Replace\n") {
$mpd->clear();
}