Class: Lolcommits::CLI::ProcessRunner
- Inherits:
-
Object
- Object
- Lolcommits::CLI::ProcessRunner
- Defined in:
- lib/lolcommits/cli/process_runner.rb
Overview
Helper class for forking lolcommits process to the background (or not).
Instance Method Summary collapse
-
#fork_me?(please) { ... } ⇒ Boolean
Forks the lolcommits process if requested.
-
#initialize(config) ⇒ ProcessRunner
constructor
Initializes a new process runner.
Constructor Details
#initialize(config) ⇒ ProcessRunner
Initializes a new process runner.
12 13 14 |
# File 'lib/lolcommits/cli/process_runner.rb', line 12 def initialize(config) @configuration = config end |
Instance Method Details
#fork_me?(please) { ... } ⇒ Boolean
Forks the lolcommits process if requested.
Writes the PID of the lolcommits process to the filesystem when backgrounded, for monitoring purposes.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lolcommits/cli/process_runner.rb', line 23 def fork_me?(please, &block) if please $stdout.sync = true write_pid fork { yield block delete_pid } else yield block end end |