Class: Builtins::Background

Inherits:
Builtin
  • Object
show all
Defined in:
lib/builtins/background.rb

Constant Summary collapse

DEFAULT_LOG_FILE_PREFIX =
"/tmp/ops_bglog_"

Instance Attribute Summary

Attributes inherited from Builtin

#args, #config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Builtin

class_for, #initialize

Constructor Details

This class inherits a constructor from Builtin

Class Method Details

.descriptionObject


10
11
12
# File 'lib/builtins/background.rb', line 10

def description
	"runs the given command in a background session"
end

.log_filenameObject


14
15
16
# File 'lib/builtins/background.rb', line 14

def log_filename
	Options.get("background.log_filename") || "#{DEFAULT_LOG_FILE_PREFIX}#{Ops.project_name}"
end

Instance Method Details

#runObject


19
20
21
22
23
24
25
26
# File 'lib/builtins/background.rb', line 19

def run
	subprocess = fork do
		set_bglog_file_permissions
		run_ops(args)
	end

	Process.detach(subprocess)
end