Module: SafePty
- Defined in:
- lib/subcontractor/cli.rb
Class Method Summary collapse
Class Method Details
.clear_more_env ⇒ Object
31 32 33 |
# File 'lib/subcontractor/cli.rb', line 31 def self.clear_more_env ['GEM_HOME', 'GEM_PATH', 'RUBYOPT', 'RBENV_DIR'].each { |e| ENV.delete(e) } end |
.spawn(command, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/subcontractor/cli.rb', line 7 def self.spawn command, &block if Object.const_defined?('Bundler') Bundler.with_clean_env do self.clear_more_env self.spawn_internal command, &block end else self.spawn_internal command, &block end end |
.spawn_internal(command, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/subcontractor/cli.rb', line 18 def self.spawn_internal command, &block PTY.spawn(command) do |r,w,p| begin yield r,w,p rescue Errno::EIO ensure Process.wait p end end $?.exitstatus end |