----------
Set-Location <path to Cygwin root directory>
Start-RestartManagerSession
Get-ChildItem . -File -Include *.exe,*.dll -Recurse | RegisterRestartManagerResource
Get-RestartManagerProcess
Stop-RestartManagerProcess
This produces the following output:
----------
Id : <process ID>
StartTime : <process start time>
Description : <executable started by cygrunsrv>
ServiceName :
ApplicationType : Console
ApplicationStatus : Running
IsRestartable : False
RebootReason : SessionMismatch
Id : <cygrunsrv process id>
StartTime : <cygrunsrv process start time>
Description : <description of service>
ServiceName : <service name>
ApplicationType : Service
ApplicationStatus : Running
IsRestartable : True
RebootReason : SessionMismatch----------
The cause of the problem, of course, is that the bRestartable member of RM_PROCESS_INFO structure is 'true' for the cygrunsrv.exe program but 'false' for the executable it runs as a service.
I can work around this by doing something like this:
CloseApplications=yes
CloseApplicationsFilter=*.chm,*.pdf
RestartApplications=yes
And then this, in [Code]:
Procedure RegisterExtraCloseApplicationsResources();
Begin
RegisterExtraCloseApplicationsResource(False, ExpandConstant('{app}\bin\cygrunsrv.exe'));
...
End;
(Making sure to omit the .exe file that cygrunsrv.exe spawns)
However this isn't perfect, because if excluded executable is started independently of cygrunsrv.exe, it will not be detected by Restart Manager.
Any ideas on other workarounds, or why the Restart Manager behaves in this way?
Thanks!
Bill