Module: Themigrator::Runner
- Includes:
- Logger
- Included in:
- Migrator
- Defined in:
- lib/themigrator/runner.rb
Defined Under Namespace
Classes: ActionFailedException, Script
Instance Method Summary
collapse
Methods included from Logger
#log_dir, #log_path
Instance Method Details
#run(script, log_file) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/themigrator/runner.rb', line 23
def run(script, log_file)
wd_dir = File.dirname(script)
log_fd = File.open(log_file, "w", 0600)
pid = Process.spawn(script, err: log_fd, out: log_fd, chdir: wd_dir)
add_pid(pid)
end
|
#wait ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/themigrator/runner.rb', line 30
def wait
processes.each do |pid|
pid, status = Process.wait2(pid)
return_code = status.exitstatus
remove_pid(pid)
if return_code != 0
raise ActionFailedException.new(pid)
end
end
end
|