Stop forced exit

Hello.
Such situation: there is openframeworks app, which before the shutdown should run some commands (I put them in the function exit()); openframeworks app ends from outside, from a dotnet application using system.diagnostics.process.kill(); the problem is that openframeworks app does not process command exit(), and off.

You are probably going to have to use signal catching

I tried the signals, but it does not fit.

i think the kill signal you are sending from .net is 9 which means that there’s no way to capture that signal, the whole process group will just immediately die. something like: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683155(v=vs.85).aspx with a ctrl c signal (usually 2 in poxis but not sure in windows) can be captured.

another possibility is to send some kind of message to the child process through a pipe or similar and then let the OF app exit by calling ofExit(0) when it receives that message

To get a signal, the program should be run in the loop while (1), and it is not suitable for the architecture of openframeworks - openframeworks the duty cycle is the glutmainloop(), and it is impossible to break into.
About the pipes - process.kill() to forcibly kills the process and no handling exit code in the app does not work.
To solve the problem I wrote a little program-companion, that periodically checks whether the process of my application, otherwise it executes the necessary commands.