#!/usr/bin/env ruby # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true def mac? RUBY_PLATFORM.match?(/darwin/) end def windows? RUBY_PLATFORM.match?(/cygwin|mswin|mingw|bccwin|wince|emx/) end def path base_path = "#{ File.dirname(__FILE__) }/.." if mac? "#{ base_path }/service_executables/mac/contrast-service" elsif windows? "#{ base_path }/service_executables/windows/contrast-service.exe" else "#{ base_path }/service_executables/linux/contrast-service" end end executable_path = path if File.exist?(executable_path) Kernel.exec(executable_path) else puts "Service executable not found at: #{ executable_path }" end