X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=process.cpp;h=1cc6a73dfbdb163453be30797756c3686056ea6a;hb=c03d51cbbfe9f4f8a28dbabbfc068573a1842b74;hp=75956de7556a758cae86a52df34424761348945c;hpb=fa2f3fe4a81e6958717ae05f6d37af2da91bcd66;p=nssm.git diff --git a/process.cpp b/process.cpp index 75956de..1cc6a73 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; @@ -313,39 +306,3 @@ void kill_process_tree(nssm_service_t *service, unsigned long pid, unsigned long CloseHandle(process_handle); } - -/* - Verify an environment block. - Returns: 1 if environment is invalid. - 0 if environment is OK. - -1 on error. -*/ -int test_environment(TCHAR *env) { - TCHAR path[PATH_LENGTH]; - GetModuleFileName(0, path, _countof(path)); - STARTUPINFO si; - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - PROCESS_INFORMATION pi; - ZeroMemory(&pi, sizeof(pi)); - unsigned long flags = CREATE_SUSPENDED; -#ifdef UNICODE - flags |= CREATE_UNICODE_ENVIRONMENT; -#endif - - /* - Try to relaunch ourselves but with the candidate environment set. - Assuming no solar flare activity, the only reason this would fail is if - the environment were invalid. - */ - if (CreateProcess(0, path, 0, 0, 0, flags, env, 0, &si, &pi)) { - TerminateProcess(pi.hProcess, 0); - } - else { - unsigned long error = GetLastError(); - if (error == ERROR_INVALID_PARAMETER) return 1; - else return -1; - } - - return 0; -}