Class: Datacenter::Shell::Local
- Inherits:
-
Object
- Object
- Datacenter::Shell::Local
- Defined in:
- lib/datacenter/shell/local.rb
Defined Under Namespace
Classes: SafeIO
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Local
constructor
A new instance of Local.
- #run(command, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Local
Returns a new instance of Local.
18 19 20 |
# File 'lib/datacenter/shell/local.rb', line 18 def initialize @mutex = Mutex.new end |
Class Method Details
.open(*args) {|shell| ... } ⇒ Object
38 39 40 41 |
# File 'lib/datacenter/shell/local.rb', line 38 def self.open(*args) shell = new *args yield shell end |
Instance Method Details
#run(command, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datacenter/shell/local.rb', line 22 def run(command, ={}) Datacenter.logger.debug(self.class) { command } opts = { chdir: [:chdir] || Dir.pwd, out: [:out] || StringIO.new, err: [:err] || StringIO.new } if RUBY_ENGINE == 'jruby' && JRUBY_VERSION < '9.0.0.0' run_system command, opts else run_open3 command, opts end end |