lib/contrast/api/communication/service_lifecycle.rb in contrast-agent-4.8.0 vs lib/contrast/api/communication/service_lifecycle.rb in contrast-agent-4.9.0
- old
+ new
@@ -1,15 +1,16 @@
# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true
+require 'contrast/components/logger'
+
module Contrast
module Api
module Communication
# Handles local service startup
module ServiceLifecycle
- include Contrast::Components::Interface
- access_component :logging, :contrast_service
+ include Contrast::Components::Logger::InstanceMethods
def attempt_local_service_startup
zombie_check
service_starter_thread.join(5)
is_service_started = Contrast::Utils::OS.running?
@@ -31,11 +32,11 @@
# Sometimes the zombie process dies between us finding it and killing it
end
end
def determine_startup_options
- return { out: :out, err: :out } if CONTRAST_SERVICE.logger_path == 'STDOUT'
- return { out: :err, err: :err } if CONTRAST_SERVICE.logger_path == 'STDERR'
+ return { out: :out, err: :out } if ::Contrast::CONTRAST_SERVICE.logger_path == 'STDOUT'
+ return { out: :err, err: :err } if ::Contrast::CONTRAST_SERVICE.logger_path == 'STDERR'
{ out: File::NULL, err: File::NULL }
end
# This is a separate method so we can overwrite it globally in specs