Hello all,
I'm trying to rewrite a front end for a console application that was originally written in C under Linux.
Unfortunately, developing this front-end in Linux is not an option due to company restrictions.
This (Linux) console application does some cleanup when it receives the SIGTERM or SIGQUIT signals (via Ctrl+C or Ctrl+\).
I recompiled this console application under Windows (using Cygwin), and is responding correctly to both key combinations when I run it from Powershell/Command prompt, so I know the "signals" are being processed correctly under Windows.
Here's my problem (or one of them): I'm running this consola applications from the front-end program I'm writing by using TProcess on a 2nd thread (essentially following the "executing external programs" wiki examples).
However, TProcess.Terminate just kills the process (skipping any processing).
Looking for information on how to send the signals before the thread is terminated -unsurprisingly- returns mostly Linux discussions (using fpKill). There is also discussion of using another console program (I don't recall the name right now) to send the signal to the 1st process, but that program needs Visual Studio to be compiled, and the link to the binaries doesn't work anymore.
So, my question is: is there a way to send signals (specifically SIGQUIT or SIGTERM) to a console app (running as a TProcess) from within Free Pascal?
Thanks!
J