lib/scissor/writer.rb in scissor-0.0.24 vs lib/scissor/writer.rb in scissor-0.0.25

- old
+ new

@@ -36,11 +36,11 @@ cmd = %w/ecasound/ end fragment_outfile = fragment_filename.extname.downcase == '.wav' ? fragment_filename : - tmpdir + (Digest::MD5.hexdigest(fragment_filename) + '.wav') + tmpdir + (Digest::MD5.hexdigest(fragment_filename.to_s) + '.wav') unless fragment_outfile.exist? run_command("ffmpeg -i \"#{fragment_filename}\" \"#{fragment_outfile}\"") end @@ -114,15 +114,12 @@ end def run_command(cmd) logger.debug("run_command: #{cmd}") - result = '' - status = Open4.popen4(cmd) do |pid, stdin, stdout, stderr| - stdin.close - logger.debug(stderr.read) - result = stdout.read - end + result, error = '', '' + status = Open4.spawn cmd, 'stdout' => result, 'stderr' => error + logger.debug(error) if status.exitstatus != 0 raise CommandFailed.new(cmd) end