vendor/cache/ruby/2.3.0/gems/unicorn-5.4.0/test/exec/test_exec.rb
# we need to flock() something to prevent these tests from running
we need to flock() something to prevent these tests from running
we need to flock () something to prevent these tests from running
def default_listen_lock(&block)
    fp = File.open(FLOCK_PATH, "rb")
    begin
      fp.flock(File::LOCK_EX)
      begin
        TCPServer.new(Unicorn::Const::DEFAULT_HOST,
                      Unicorn::Const::DEFAULT_PORT).close
      rescue Errno::EADDRINUSE, Errno::EACCES
        warn "can't bind to #{Unicorn::Const::DEFAULT_LISTEN}"
        return false
      end
      lock_path = "#{Dir::tmpdir}/unicorn_test." \
                  "#{Unicorn::Const::DEFAULT_LISTEN}.lock"
      begin
        File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
        yield
      rescue Errno::EEXIST
        lock_path = nil
        return false
      ensure
        File.unlink(lock_path) if lock_path
      end
    ensure
      fp.flock(File::LOCK_UN)
    end
  end
def default_listen_lock ( & block ) fp = File . open ( FLOCK_PATH , "rb" ) begin fp . flock ( File :: LOCK_EX ) begin TCPServer . new ( Unicorn :: Const :: DEFAULT_HOST , Unicorn :: Const :: DEFAULT_PORT ) . close rescue Errno :: EADDRINUSE , Errno :: EACCES warn "can't bind to #{Unicorn::Const::DEFAULT_LISTEN}" return false end lock_path = "#{Dir::tmpdir}/unicorn_test." "#{Unicorn::Const::DEFAULT_LISTEN}.lock" begin File . open ( lock_path , File :: WRONLY | File :: CREAT | File :: EXCL , 0600 ) yield rescue Errno :: EEXIST lock_path = nil return false ensure File . unlink ( lock_path ) if lock_path end ensure fp . flock ( File :: LOCK_UN ) end end
we need to flock() something to prevent these tests from running
we need to flock () something to prevent these tests from running
# unused_port should never take this, but we may run an environment # where tests are being run against older unicorns...
block
<not_specific>