Sha256: ec3901c23cab0c0d71c472e3bafbc28c365538a7b5af6a85075bde68e00e510b

Contents?: true

Size: 961 Bytes

Versions: 64

Compression:

Stored size: 961 Bytes

Contents

require 'sys/proctable'

module Acceptance
  module VirtualBox
    extend self

    # This method will wait for the "VBoxSVC" process to end. This will
    # block during that time period. The reason for this is because only
    # one "VBoxSVC" can run per user and manages all state within VirtualBox.
    # Before you can run VirtualBox with a custom home directory, you must
    # wait for this VBoxSVC process to die.
    def wait_for_vboxsvc
      time_passed = 0
      while find_vboxsvc
        if time_passed > 5
          raise Exception, "VBoxSVC process is not going away."
        end

        sleep 1
        time_passed += 1
      end
    end

    # This method finds the VBoxSVC process and returns information about it.
    # This will return "nil" if VBoxSVC is not found.
    def find_vboxsvc
      Sys::ProcTable.ps do |process|
        if process.comm == "VBoxSVC"
          return process
        end
      end

      nil
    end
  end
end

Version data entries

64 entries across 64 versions & 11 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/virtualbox.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/virtualbox.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/virtualbox.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/virtualbox.rb
bmhatfield-vagrant-1.0.10 test/acceptance/support/virtualbox.rb
bmhatfield-vagrant-1.0.9 test/acceptance/support/virtualbox.rb
tnargav-1.3.6 test/acceptance/support/virtualbox.rb
tnargav-1.3.3 test/acceptance/support/virtualbox.rb
bmhatfield-vagrant-1.0.8 test/acceptance/support/virtualbox.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/support/virtualbox.rb
tnargav-1.2.3 test/acceptance/support/virtualbox.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/support/virtualbox.rb
bmhatfield-vagrant-1.0.7 test/acceptance/support/virtualbox.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/support/virtualbox.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/support/virtualbox.rb
tnargav-1.2.2 test/acceptance/support/virtualbox.rb
vagrantup-1.1.3 test/acceptance/support/virtualbox.rb
vagrantup-1.1.2 test/acceptance/support/virtualbox.rb
vagrantup-1.1.1 test/acceptance/support/virtualbox.rb
vagrantup-1.1.0 test/acceptance/support/virtualbox.rb