Sha256: cc2f822ee5963b0998948c111d5342446bd0738d4d455abea40fe0a14e84e2a8

Contents?: true

Size: 421 Bytes

Versions: 1

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

module Whatup
  module Server
    module Redirection
      # Reroutes stdin and stdout inside a block
      def redirect stdin: $stdin, stdout: $stdout
        original_stdin  = $stdin
        original_stdout = $stdout
        $stdin  = stdin
        $stdout = stdout
        yield
      ensure
        $stdin  = original_stdin
        $stdout = original_stdout
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whatup-0.2.5 lib/whatup/server/redirection.rb