Module: Kernel
- Defined in:
- lib/neverblock/core/system/system.rb
Instance Method Summary collapse
- #backticks(cmd, *args) ⇒ Object
- #rb_sleep ⇒ Object
- #rb_system ⇒ Object
- #sleep(time = nil) ⇒ Object
- #system(cmd, *args) ⇒ Object
Instance Method Details
#backticks(cmd, *args) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/neverblock/core/system/system.rb', line 28 def backticks(cmd, *args) myargs = "#{cmd} " myargs << args.join(' ') if args res = '' IO.popen(myargs) do |f| res << f.read end res end |
#rb_sleep ⇒ Object
6 |
# File 'lib/neverblock/core/system/system.rb', line 6 alias_method :rb_sleep, :sleep |
#rb_system ⇒ Object
13 |
# File 'lib/neverblock/core/system/system.rb', line 13 alias_method :rb_system, :system |
#sleep(time = nil) ⇒ Object
8 9 10 11 |
# File 'lib/neverblock/core/system/system.rb', line 8 def sleep(time=nil) return rb_sleep(time) unless NB.neverblocking? NB.sleep(time) end |
#system(cmd, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/neverblock/core/system/system.rb', line 15 def system(cmd, *args) return rb_system(cmd, *args) unless NB.neverblocking? begin backticks(cmd, *args) result = $?.exitstatus return true if result.zero? return nil if result == 127 return false rescue Errno::ENOENT => e return nil end end |