Method: Dev::UI::StdoutRouter::Capture.with_stdin_masked
- Defined in:
- lib/dev/ui/stdout_router.rb
.with_stdin_masked ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/dev/ui/stdout_router.rb', line 65 def self.with_stdin_masked @m.synchronize do if @active_captures.zero? @saved_stdin = $stdin $stdin, w = IO.pipe $stdin.close w.close end @active_captures += 1 end yield ensure @m.synchronize do @active_captures -= 1 if @active_captures.zero? $stdin = @saved_stdin end end end |