Class: Jackal::Utils::Process
- Inherits:
-
Object
- Object
- Jackal::Utils::Process
- Defined in:
- lib/jackal/utils/process.rb
Instance Method Summary collapse
-
#create_io_tmp(*args) ⇒ IO
Temporary IO for logging.
-
#initialize ⇒ self
constructor
Create new instance.
-
#process(identifier, *command) {|| ... } ⇒ TrueClass
Create new process.
Constructor Details
#initialize ⇒ self
Create new instance
14 15 16 17 18 19 20 |
# File 'lib/jackal/utils/process.rb', line 14 def initialize @storage_directory = Carnivore::Config.fetch( :fission, :utils, :process_manager, :storage, '/tmp/fission/process_manager' ) FileUtils.mkdir_p(@storage_directory) end |
Instance Method Details
#create_io_tmp(*args) ⇒ IO
Temporary IO for logging
42 43 44 45 46 47 48 |
# File 'lib/jackal/utils/process.rb', line 42 def create_io_tmp(*args) path = File.join(@storage_directory, args.join('-')) FileUtils.mkdir_p(File.dirname(path)) t_file = File.open(path, 'w+') t_file.sync t_file end |
#process(identifier, *command) {|| ... } ⇒ TrueClass
Create new process
28 29 30 31 32 33 34 35 36 |
# File 'lib/jackal/utils/process.rb', line 28 def process(identifier, *command) if(command.size == 1) command = Shellwords.shellsplit(command.first) end if(block_given?) yield ChildProcess.build(*command) end true end |