Module: SimpleWorker::AbstractWorker

Included in:
LocalWorker, SshWorker
Defined in:
lib/simpleworker/abstract_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd.



4
5
6
# File 'lib/simpleworker/abstract_worker.rb', line 4

def cmd
  @cmd
end

#scriptObject

Returns the value of attribute script.



4
5
6
# File 'lib/simpleworker/abstract_worker.rb', line 4

def script
  @script
end

Instance Method Details

#envObject



28
29
30
# File 'lib/simpleworker/abstract_worker.rb', line 28

def env
  @env
end

#startObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simpleworker/abstract_worker.rb', line 6

def start
  if script.kind_of? Array
    @process = ChildProcess.build *script
  else
    @process = ChildProcess.build script
  end

  @process.io.inherit!

  set_process_env

  @process.start
end

#stopObject



24
25
26
# File 'lib/simpleworker/abstract_worker.rb', line 24

def stop
  @process.stop
end

#waitObject



20
21
22
# File 'lib/simpleworker/abstract_worker.rb', line 20

def wait
  @process.wait
end