Module: Kernel
- Defined in:
- lib/webby/core_ext/kernel.rb
Constant Summary collapse
- WINDOWS =
:stopdoc:
%r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM
- DEV_NULL =
WINDOWS ? 'NUL:' : '/dev/null'
Instance Method Summary collapse
-
#cmd_available?(*args) ⇒ Boolean
:startdoc:.
- #journal ⇒ Object
Instance Method Details
#cmd_available?(*args) ⇒ Boolean
:startdoc:
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/webby/core_ext/kernel.rb', line 9 def cmd_available?( *args ) io = [STDOUT.dup, STDERR.dup] STDOUT.reopen DEV_NULL STDERR.reopen DEV_NULL system(*(args.flatten)) ensure STDOUT.reopen io.first STDERR.reopen io.last $stdout, $stderr = STDOUT, STDERR end |