Class: Specwrk::CLI::Work

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
Clientable, Workable
Defined in:
lib/specwrk/cli.rb

Constant Summary

Constants included from WorkerProcesses

Specwrk::CLI::WorkerProcesses::WORKER_INIT_SCRIPT

Instance Method Summary collapse

Methods included from Hookable

extended, #included, #included_hooks, #on_included, #on_setup, #setup_hooks

Methods included from WorkerProcesses

#drain_outputs, #start_workers, #worker_count, #worker_env_for

Instance Method Details

#call(**args) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/specwrk/cli.rb', line 202

def call(**args)
  self.class.setup(**args)

  start_workers
  wait_for_workers_exit
  drain_outputs

  require "specwrk/cli_reporter"
  Specwrk::CLIReporter.new.report

  exit(status)
end

#statusObject



219
220
221
# File 'lib/specwrk/cli.rb', line 219

def status
  @exited_pids.value?(1) ? 1 : 0
end

#wait_for_workers_exitObject



215
216
217
# File 'lib/specwrk/cli.rb', line 215

def wait_for_workers_exit
  @exited_pids = Specwrk.wait_for_pids_exit(@worker_pids)
end