From 670499b6f0b591316867c575bd80129aebbbe69f Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 26 May 2017 18:58:54 +0100 Subject: [PATCH] Avoid releasing console twice on failure to read pid file. --- src/service.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/service.cc b/src/service.cc index 25b6294..c5a60f3 100644 --- a/src/service.cc +++ b/src/service.cc @@ -695,18 +695,18 @@ bool ServiceRecord::read_pid_file() noexcept void ServiceRecord::started() noexcept { - if (onstart_flags.runs_on_console && (service_type == ServiceType::SCRIPTED || service_type == ServiceType::BGPROCESS)) { - tcsetpgrp(0, getpgrp()); - releaseConsole(); - } - if (service_type == ServiceType::BGPROCESS && pid_file.length() != 0) { if (! read_pid_file()) { failed_to_start(); return; } } - + + if (onstart_flags.runs_on_console && (service_type == ServiceType::SCRIPTED || service_type == ServiceType::BGPROCESS)) { + tcsetpgrp(0, getpgrp()); + releaseConsole(); + } + logServiceStarted(service_name); service_state = ServiceState::STARTED; notifyListeners(ServiceEvent::STARTED); -- 2.25.1