INNER CODE UNIT · Ruby

capture

EugenMayer/docker-sync · lib/docker-sync/command.rb:83

    def capture(limit)
      streams = [@stdout, @stderr]
      streams << STDIN if STDIN.tty?

      ready, = IO.select(streams, [], [], limit)

      # proxy STDIN to child's stdin
      if ready && ready.include?(STDIN)
        data = STDIN.readpartial(CHUNK) rescue nil
        if data
          @captured_input << data
          @stdin.write(data)
        else
          # our own STDIN got closed; proxy this fact to the child
          @stdin.close unless @stdin.closed?
        end
      end

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…