about summary refs log tree commit homepage
path: root/lib/dtas
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-19 09:04:18 +0000
committerEric Wong <e@80x24.org>2015-01-19 09:58:47 +0000
commitb95a51440b6378847c4ab5dd4cf9e96e18b5f241 (patch)
treec9266398424220484c9f9c2b4969c9908abc5b89 /lib/dtas
parent723cd6da883bda87e092707ce17c31190a1c5205 (diff)
downloaddtas-b95a51440b6378847c4ab5dd4cf9e96e18b5f241.tar.gz
This makes debugging, grepping, and following code confusing
at times and also unexpected breaks usage of the global "spawn"
method.
Diffstat (limited to 'lib/dtas')
-rw-r--r--lib/dtas/partstats.rb7
-rw-r--r--lib/dtas/player.rb4
-rw-r--r--lib/dtas/player/client_handler.rb2
-rw-r--r--lib/dtas/sink.rb4
-rw-r--r--lib/dtas/source/av_ff_common.rb4
-rw-r--r--lib/dtas/source/cmd.rb4
-rw-r--r--lib/dtas/source/sox.rb4
-rw-r--r--lib/dtas/source/splitfx.rb4
-rw-r--r--lib/dtas/splitfx.rb6
9 files changed, 20 insertions, 19 deletions
diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb
index 76e4940..6c714b3 100644
--- a/lib/dtas/partstats.rb
+++ b/lib/dtas/partstats.rb
@@ -49,7 +49,7 @@ class DTAS::PartStats
     rv
   end
 
-  def spawn(trim_part, opts)
+  def partstats_spawn(trim_part, opts)
     rd, wr = IO.pipe
     env = opts[:env]
     env = env ? env.dup : {}
@@ -58,7 +58,8 @@ class DTAS::PartStats
     opts = { pgroup: true, close_others: true, err: wr }
     pid = begin
       Process.spawn(env, CMD, opts)
-    rescue Errno::EINTR # Ruby bug?
+    rescue Errno::EINTR
+      # workaround for older Rubies https://bugs.ruby-lang.org/issues/8770
       retry
     end
     wr.close
@@ -74,7 +75,7 @@ class DTAS::PartStats
     stats = []
     fails = []
     do_spawn = lambda do |trim_part|
-      pid, rpipe = spawn(trim_part, opts)
+      pid, rpipe = partstats_spawn(trim_part, opts)
       rset[rpipe] = [ trim_part, "" ]
       pids[pid] = [ trim_part, rpipe ]
     end
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index 002decf..dd037b0 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -348,7 +348,7 @@ class DTAS::Player # :nodoc:
     @sinks.each_value do |sink|
       sink.active or next
       next if sink.pid
-      @targets.concat(sink.spawn(@format))
+      @targets.concat(sink.sink_spawn(@format))
     end
     if @targets[0]
       @targets.sort_by! { |t| t.sink.prio }
@@ -413,7 +413,7 @@ class DTAS::Player # :nodoc:
 
       dst = @sink_buf
       pending.dst_assoc(dst)
-      pending.spawn(@format, @rg, out: dst.wr, in: "/dev/null")
+      pending.src_spawn(@format, @rg, out: dst.wr, in: "/dev/null")
 
       # watch and restart on modifications
       pending.respond_to?(:watch_begin) and
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index e1e68aa..e216ffd 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -69,7 +69,7 @@ module DTAS::Player::ClientHandler # :nodoc:
 
   def __sink_activate(sink)
     return if sink.pid
-    @targets.concat(sink.spawn(@format))
+    @targets.concat(sink.sink_spawn(@format))
     @targets.sort_by! { |t| t.sink.prio }
   end
 
diff --git a/lib/dtas/sink.rb b/lib/dtas/sink.rb
index b06e284..3eaab75 100644
--- a/lib/dtas/sink.rb
+++ b/lib/dtas/sink.rb
@@ -66,8 +66,8 @@ class DTAS::Sink # :nodoc:
     super
   end
 
-  def spawn(format, opts = {})
-    raise "BUG: #{self.inspect}#spawn called twice" if @pid
+  def sink_spawn(format, opts = {})
+    raise "BUG: #{self.inspect}#sink_spawn called twice" if @pid
     rv = []
 
     pclass = @nonblock ? DTAS::PipeNB : DTAS::Pipe
diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb
index ea0c01a..89d762d 100644
--- a/lib/dtas/source/av_ff_common.rb
+++ b/lib/dtas/source/av_ff_common.rb
@@ -127,8 +127,8 @@ module DTAS::Source::AvFfCommon # :nodoc:
     raise "BUG: no audio stream in #@infile"
   end
 
-  def spawn(player_format, rg_state, opts)
-    raise "BUG: #{self.inspect}#spawn called twice" if @to_io
+  def src_spawn(player_format, rg_state, opts)
+    raise "BUG: #{self.inspect}#src_spawn called twice" if @to_io
     amap = nil
 
     # try to find an audio stream which matches our channel count
diff --git a/lib/dtas/source/cmd.rb b/lib/dtas/source/cmd.rb
index b2cd8e3..0f4c3f6 100644
--- a/lib/dtas/source/cmd.rb
+++ b/lib/dtas/source/cmd.rb
@@ -31,8 +31,8 @@ class DTAS::Source::Cmd # :nodoc:
 
   alias to_hsh to_hash
 
-  def spawn(format, rg_state, opts)
-    raise "BUG: #{self.inspect}#spawn called twice" if @to_io
+  def src_spawn(format, rg_state, opts)
+    raise "BUG: #{self.inspect}#src_spawn called twice" if @to_io
     e = format.to_env
     @pid = dtas_spawn(e.merge!(@env), command_string, opts)
   end
diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb
index 7cfecc5..8e8e59e 100644
--- a/lib/dtas/source/sox.rb
+++ b/lib/dtas/source/sox.rb
@@ -75,8 +75,8 @@ class DTAS::Source::Sox # :nodoc:
     tmp
   end
 
-  def spawn(player_format, rg_state, opts)
-    raise "BUG: #{self.inspect}#spawn called twice" if @to_io
+  def src_spawn(player_format, rg_state, opts)
+    raise "BUG: #{self.inspect}#src_spawn called twice" if @to_io
     e = @env.merge!(player_format.to_env)
     e["INFILE"] = @infile
 
diff --git a/lib/dtas/source/splitfx.rb b/lib/dtas/source/splitfx.rb
index 80d8473..adfde61 100644
--- a/lib/dtas/source/splitfx.rb
+++ b/lib/dtas/source/splitfx.rb
@@ -60,8 +60,8 @@ class DTAS::Source::SplitFX < DTAS::Source::Sox # :nodoc:
     @ymlhash["command"] || super
   end
 
-  def spawn(player_format, rg_state, opts)
-    raise "BUG: #{self.inspect}#spawn called twice" if @to_io
+  def src_spawn(player_format, rg_state, opts)
+    raise "BUG: #{self.inspect}#src_spawn called twice" if @to_io
     e = @env.merge!(player_format.to_env)
     @sfx.infile_env(e, @sox.infile)
 
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index 71b716a..fc5f47f 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -156,7 +156,7 @@ class DTAS::SplitFX # :nodoc:
     { "command" => CMD, "format" => outfmt }
   end
 
-  def spawn(target, t, opts)
+  def splitfx_spawn(target, t, opts)
     target = @targets[target] || generic_target(target)
     outfmt = target["format"]
 
@@ -327,7 +327,7 @@ class DTAS::SplitFX # :nodoc:
     jobs = opts[:jobs] || tracks.size # jobs == nil => everything at once
     jobs.times.each do
       t = tracks.shift or break
-      pid, tmp = spawn(target, t, opts)
+      pid, tmp = splitfx_spawn(target, t, opts)
       pids[pid] = [ t, tmp ]
     end
 
@@ -336,7 +336,7 @@ class DTAS::SplitFX # :nodoc:
       done = pids.delete(pid)
       if status.success?
         if t = tracks.shift
-          pid, tmp = spawn(target, t, opts)
+          pid, tmp = splitfx_spawn(target, t, opts)
           pids[pid] = [ t, tmp ]
         end
         puts "DONE #{done[0].inspect}" if $DEBUG