diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-26 08:50:12 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-26 08:50:12 +0000 |
commit | aecc68d704e251775732da23eea1cfa301316d65 (patch) | |
tree | d1c9119b54bbc7f91ba46dd05f9893c9f0e3aae7 | |
parent | da7f831f1a0404992329690c45a5000837bc2660 (diff) | |
download | dtas-aecc68d704e251775732da23eea1cfa301316d65.tar.gz |
This should hopefully prevent us from getting wedged if we hit an error while preparing to spawn (or during spawn).
-rw-r--r-- | lib/dtas/player.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index 0e7a4b5..a508488 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -346,19 +346,20 @@ class DTAS::Player # :nodoc: case source_spec when String - @current = try_file(source_spec) or return - echo(%W(file #{@current.infile})) + pending = try_file(source_spec) or return + echo(%W(file #{pending.infile})) when Array - @current = try_file(*source_spec) or return - echo(%W(file #{@current.infile} #{@current.offset_samples}s)) + pending = try_file(*source_spec) or return + echo(%W(file #{pending.infile} #{pending.offset_samples}s)) else - @current = DTAS::Source::Cmd.new(source_spec["command"]) - echo(%W(command #{@current.command_string})) + pending = DTAS::Source::Cmd.new(source_spec["command"]) + echo(%W(command #{pending.command_string})) end dst = @sink_buf - @current.dst_assoc(dst) - @current.spawn(@format, @rg, out: dst.wr, in: "/dev/null") + pending.dst_assoc(dst) + pending.spawn(@format, @rg, out: dst.wr, in: "/dev/null") + @current = pending @srv.wait_ctl(dst, :wait_readable) else stop_sinks if @sink_buf.inflight == 0 |