Class: Builtins::Background

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

Constant Summary collapse

DEFAULT_LOG_FILE_PREFIX =
"/tmp/ops_bglog_"

Constants inherited from Builtin

Builtin::BUILTIN_DIR

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



8
9
10
# File 'lib/builtins/background.rb', line 8

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

.log_filenameObject



12
13
14
# File 'lib/builtins/background.rb', line 12

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

Instance Method Details

#runObject



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

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

	Process.detach(subprocess)

	true
end