Sha256: 2d81341c9bfb9ffc080bfa4af448bdd423a4e125cad4a26c4dd6f3d9fb8570bd
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module Vagrant module Notify module Action class StopServer def initialize(app, env) @app = app end def call(env) return if env[:machine].config.notify.enable == false if env[:machine].state.id == :running env[:machine].communicate.sudo('rm /usr/bin/notify-send; exit 0') env[:machine].communicate.sudo('mv /usr/bin/{notify-send.bkp,notify-send}; exit 0') end @app.call env pid = env[:notify_data][:pid] begin Process.kill('KILL', pid.to_i) env[:machine].ui.success("Stopped vagrant-notify-server pid: #{pid}") rescue Errno::ESRCH nil rescue env[:machine].ui.error("Failed to stop vagrant-notify-server pid: #{pid}") end env[:notify_data][:pid] = nil env[:notify_data][:port] = nil env[:notify_data][:bind_ip] = nil unless env[:notify_restart] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems