X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.cpp;h=e9fd109bb096f5c779dc607fcdea9e8f311e4ce1;hb=b0a6672810ee06052dc3dcf268274d06f0e82a50;hp=ee60c1072fa7f0cd36712db4489f9bf09f9270ed;hpb=eac4d7eedfe338703f0103aac01af2ca306f615a;p=nssm.git diff --git a/service.cpp b/service.cpp index ee60c10..e9fd109 100644 --- a/service.cpp +++ b/service.cpp @@ -1530,7 +1530,6 @@ int start_service(nssm_service_t *service) { bool inherit_handles = false; if (si.dwFlags & STARTF_USESTDHANDLES) inherit_handles = true; unsigned long flags = service->priority & priority_mask(); - if (service->stdin_pipe) flags |= DETACHED_PROCESS; if (service->affinity) flags |= CREATE_SUSPENDED; if (! CreateProcess(0, cmd, 0, 0, inherit_handles, flags, 0, service->dir, &si, &pi)) { unsigned long exitcode = 3; @@ -1547,6 +1546,8 @@ int start_service(nssm_service_t *service) { close_output_handles(&si); + if (! service->no_console) FreeConsole(); + /* Restore our environment. */ duplicate_environment(service->initial_env); @@ -1620,10 +1621,6 @@ int stop_service(nssm_service_t *service, unsigned long exitcode, bool graceful, UnregisterWait(service->wait_handle); service->wait_handle = 0; } - if (service->stdin_pipe) { - CloseHandle(service->stdin_pipe); - service->stdin_pipe = 0; - } service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_OFFLINE;