Commit aa1f5759 authored by bbguimaraes's avatar bbguimaraes
Browse files

scripts/sink: check `system` calls

parent 02aab09c
......@@ -8,13 +8,17 @@ sub main {
return print @sinks if !$sink;
my $id = find_sink(map_sink_name($sink, `hostname`), \@sinks);
die "sink $sink not found" if !$id;
system "pactl set-default-sink $id";
exec_cmd("pactl", "set-default-sink", "$id");
foreach(`pactl list short sink-inputs`) {
my @f = split;
system "pactl move-sink-input $f[0] $id";
exec_cmd("pactl", "move-sink-input", $f[0], $id);
}
}
sub exec_cmd {
die "command failed: @_" if system(@_);
}
sub find_sink {
my ($sink, $sinks) = @_;
return $sink if $sink =~ m/^[0-9]+$/;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment