}\r
else {\r
CloseHandle(service_handle);\r
- _ftprintf(stderr, _T("%s: %s %s"), canonical_name, service_control_text(control), error_string(error));\r
+ _ftprintf(stderr, _T("%s: %s: %s"), canonical_name, service_control_text(control), error_string(error));\r
return 1;\r
}\r
}\r
ZeroMemory(&service->throttle_duetime, sizeof(service->throttle_duetime));\r
SetWaitableTimer(service->throttle_timer, &service->throttle_duetime, 0, 0, 0, 0);\r
}\r
- service->status.dwCurrentState = SERVICE_CONTINUE_PENDING;\r
+ /* We can't continue if the application is running! */\r
+ if (! service->process_handle) service->status.dwCurrentState = SERVICE_CONTINUE_PENDING;\r
service->status.dwWaitHint = throttle_milliseconds(service->throttle) + NSSM_WAITHINT_MARGIN;\r
log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_RESET_THROTTLE, service->name, 0);\r
SetServiceStatus(service->status_handle, &service->status);\r
\r
case NSSM_SERVICE_CONTROL_ROTATE:\r
log_service_control(service->name, control, true);\r
- if (service->rotate_stdout_online) service->rotate_stdout_online = NSSM_ROTATE_ONLINE_ASAP;\r
- if (service->rotate_stdout_online) service->rotate_stderr_online = NSSM_ROTATE_ONLINE_ASAP;\r
+ if (service->rotate_stdout_online == NSSM_ROTATE_ONLINE) service->rotate_stdout_online = NSSM_ROTATE_ONLINE_ASAP;\r
+ if (service->rotate_stderr_online == NSSM_ROTATE_ONLINE) service->rotate_stderr_online = NSSM_ROTATE_ONLINE_ASAP;\r
return NO_ERROR;\r
}\r
\r
\r
if (get_process_creation_time(service->process_handle, &service->creation_time)) ZeroMemory(&service->creation_time, sizeof(service->creation_time));\r
\r
- close_output_handles(&si, ! service->rotate_stdout_online, ! service->rotate_stderr_online);\r
+ close_output_handles(&si);\r
\r
if (service->affinity) {\r
/*\r
service->wait_handle = 0;\r
}\r
\r
+ service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_OFFLINE;\r
+\r
if (default_action && ! exitcode && ! graceful) {\r
log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service->name, service->exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY], 0);\r
graceful = true;\r
\r
service->stopping = true;\r
\r
+ service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_OFFLINE;\r
+\r
/* Check exit code */\r
unsigned long exitcode = 0;\r
TCHAR code[16];\r