I have a C# Windows service that creates subprocesses. How can I stop those subprocesses gracefully from my Windows service? I have tried lot of ways without success.
The main process is starting the sub process who is starting a video recording session. At some point the main process need to notify the sub process to stop recording. This has to be done by gracefully closing the sub process (or sending ctrl-c). I am able to achieve this in a console app but not a windows service. Also, I do not control that sub process, it's an executable from a 3rd party.
The sub process must close gracefully since it needs to save document, terminate the process is not an option.