Sha256: 60235761f44cff24ff781fc71ba7b161ca2cfdbe69ee3b5657f96e21717886c5

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
# common code for wrapping SoX/ecasound/... commands
require_relative 'serialize'
require 'shellwords'

module DTAS::Command # :nodoc:
  include DTAS::Serialize
  attr_reader :pid
  attr_reader :to_io
  attr_accessor :command
  attr_accessor :env
  attr_accessor :spawn_at

  COMMAND_DEFAULTS = {
    "env" => {},
    "command" => nil,
  }

  def command_init(defaults = {})
    @pid = nil
    @to_io = nil
    @spawn_at = nil
    COMMAND_DEFAULTS.merge(defaults).each do |k,v|
      v = v.dup if Hash === v || Array === v
      instance_variable_set("@#{k}", v)
    end
  end

  def on_death(status)
    @pid = nil
  end

  def command_string
    @command
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dtas-0.7.0 lib/dtas/command.rb
dtas-0.6.0 lib/dtas/command.rb
dtas-0.5.0 lib/dtas/command.rb
dtas-0.4.0 lib/dtas/command.rb
dtas-0.3.0 lib/dtas/command.rb