You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nonblock_pipe.rb
    path of file: ./repos/travis-build/lib/travis/build/appliances
    
    the code of the file until where you have to start completion: require 'travis/build/appliances/base'

module Travis
  module Build
    module Appliances
      class NonblockPipe < Base

        def apply
          command = <<-EOF
if [[ $TRAVIS_FILTERED = redirect_io ]]; then
  cat <<\\EOPY >~/nonblock.py
import os
import sys
import fcntl

flags_stdout = fcntl.fcntl(sys.stdout, fcntl.F_GETFL)
fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags_stdout&~os.O_NONBLOCK)
    
        def apply
          command = <<-EOF
if [[ $TRAVIS_FILTERED = redirect_io ]]; then
  cat <<\\EOPY >~/nonblock.py
import os
import sys
import fcntl

flags_stdout = fcntl.fcntl(sys.stdout, fcntl.F_GETFL)
fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags_stdout&~os.O_NONBLOCK)

flags_stderr = fcntl.fcntl(sys.stderr, fcntl.F_GETFL)
fcntl.fcntl(sys.stderr, fcntl.F_SETFL, flags_stderr&~os.O_NONBLOCK)
EOPY
  python ~/nonblock.py
  rm ~/nonblock.py
fi
EOF

          sh.cmd command
        end