X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=process.cpp;h=0a8c18b60d322c119e934fa84475db40301d999b;hb=54438652fac1f4f8dc6120bbfa8aac766aa656d3;hp=59707c464243d694dda7c33f3a094a7f6a816733;hpb=ba4831e5eb179e415282a957604f039bceb4804f;p=nssm.git diff --git a/process.cpp b/process.cpp index 59707c4..0a8c18b 100644 --- a/process.cpp +++ b/process.cpp @@ -149,13 +149,6 @@ int kill_process(nssm_service_t *service, HANDLE process_handle, unsigned long p kill_t k = { pid, exitcode, 0 }; - /* Close the stdin pipe. */ - if (service->stdin_pipe) { - CloseHandle(service->stdin_pipe); - service->stdin_pipe = 0; - if (! await_shutdown(service, _T(__FUNCTION__), service->kill_console_delay)) return 1; - } - /* Try to send a Control-C event to the console. */ if (service->stop_method & NSSM_STOP_METHOD_CONSOLE) { if (! kill_console(service)) return 1; @@ -215,6 +208,8 @@ int kill_console(nssm_service_t *service) { return 2; case ERROR_ACCESS_DENIED: + /* Maybe we already allocated a console for output. */ + if (service->stdin_path[0] || service->stdout_path[0] || service->stderr_path[0]) break; default: /* We already have a console. */ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_ATTACHCONSOLE_FAILED, service->name, error_string(ret), 0);