dtas.git  about / heads / tags
duct tape audio suite for *nix
blob cdcd3b39db66f7ccc442c3cd1bc52a9727a7b4d7 939 bytes (raw)
$ git show v0.16.1:lib/dtas/source/cmd.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
require_relative '../../dtas'
require_relative '../source'
require_relative '../command'
require_relative '../serialize'

class DTAS::Source::Cmd # :nodoc:
  require_relative '../source/common'

  include DTAS::Command
  include DTAS::Process
  include DTAS::Source::Common
  include DTAS::Serialize

  SIVS = %w(command env)

  def initialize(command)
    command_init(command: command)
  end

  def source_dup
    rv = self.class.new
    SIVS.each { |iv| rv.__send__("#{iv}=", self.__send__(iv)) }
    rv
  end

  def to_hash
    ivars_to_hash(SIVS)
  end

  alias to_hsh to_hash

  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
end

git clone git://80x24.org/dtas.git
git clone https://80x24.org/dtas.git