- bool inherit_handles = false;\r
- if (si.dwFlags & STARTF_USESTDHANDLES) inherit_handles = true;\r
- unsigned long flags = service->priority & priority_mask();\r
- if (service->affinity) flags |= CREATE_SUSPENDED;\r
- if (! CreateProcess(0, cmd, 0, 0, inherit_handles, flags, 0, service->dir, &si, &pi)) {\r
- unsigned long exitcode = 3;\r
- unsigned long error = GetLastError();\r
- log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEPROCESS_FAILED, service->name, service->exe, error_string(error), 0);\r
- close_output_handles(&si);\r
- duplicate_environment_strings(service->initial_env);\r
- return stop_service(service, exitcode, true, true);\r
- }\r
- service->start_count++;\r
- service->process_handle = pi.hProcess;\r
- service->pid = pi.dwProcessId;\r
+ bool inherit_handles = false;\r
+ if (si.dwFlags & STARTF_USESTDHANDLES) inherit_handles = true;\r
+ unsigned long flags = service->priority & priority_mask();\r
+ if (service->affinity) flags |= CREATE_SUSPENDED;\r
+ if (! CreateProcess(0, cmd, 0, 0, inherit_handles, flags, 0, service->dir, &si, &pi)) {\r
+ unsigned long exitcode = 3;\r
+ unsigned long error = GetLastError();\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEPROCESS_FAILED, service->name, service->exe, error_string(error), 0);\r
+ close_output_handles(&si);\r
+ duplicate_environment_strings(service->initial_env);\r
+ return stop_service(service, exitcode, true, true);\r
+ }\r
+ service->start_count++;\r
+ service->process_handle = pi.hProcess;\r
+ service->pid = pi.dwProcessId;\r