lib/alsa/aconnect/cmd.rb in alsa_aconnect-0.1.1 vs lib/alsa/aconnect/cmd.rb in alsa_aconnect-0.1.2
- old
+ new
@@ -1,7 +1,9 @@
# frozen_string_literal: true
+require 'open3'
+
module ALSA
module Aconnect
class Cmd
EXEC = 'aconnect'
@@ -13,13 +15,15 @@
@exec = exec
@arguments = arguments
end
def run
- status, out, err = Command.run(@exec, *@arguments)
- raise Error.new(status.exitstatus, err.join("\n")) if status != 0 || !err.empty?
+ cmd = [@exec, *@arguments].compact.join(' ')
+ out, err, status = Open3.capture3(cmd)
+ code = status.exitstatus
+ raise Error.new code, err.join("\n") unless code.zero?
- out.join("\n")
+ out
end
end
end
end