class Spring::Client::Stop

def call

def call
  if env.server_running?
    timeout = Time.now + TIMEOUT
    kill 'TERM'
    sleep 0.1 until !env.server_running? || Time.now >= timeout
    if env.server_running?
      $stderr.puts "Spring did not stop; killing forcibly."
      kill 'KILL'
    else
      puts "Spring stopped."
    end
  else
    puts "Spring is not running"
  end
end