Class: Helpers::Exec
- Inherits:
-
Object
- Object
- Helpers::Exec
- Defined in:
- lib/amnesie/helpers.rb
Instance Method Summary collapse
-
#initialize(name) ⇒ Exec
constructor
A new instance of Exec.
- #run(args) ⇒ Object
Constructor Details
#initialize(name) ⇒ Exec
Returns a new instance of Exec.
6 7 8 9 |
# File 'lib/amnesie/helpers.rb', line 6 def initialize(name) @search_uid = Process::Sys.getuid @name = name end |
Instance Method Details
#run(args) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/amnesie/helpers.rb', line 11 def run(args) if @search_uid == 0 then #puts "found root - uid #{@search_uid}" system(@name + " " + args) else #puts "sudo #{@name} #{args}" system("sudo " + @name + " " + args) end end |