How kill executables started with spawnShell or executeShell when program finish?
Jack
jckj33 at gmail.com
Tue Oct 27 19:45:02 UTC 2020
On Tuesday, 27 October 2020 at 15:16:33 UTC, Marcone wrote:
> Becouse my program use plink.exe running with spawnShell or
> executeShell.
> But when my program finish with some crash, or killed with
> windows task manager by user, Plink still running. How can I
> stop all process initialized with spawnShell or executeShell
> when program finish? I another works, how can I make plink.exe
> only lives when program is running?
if you want to close plink.exe when the application that started
it closes by user's request, crash or forceully by the task
manager, WIN32API's JOB functions does that job. I've used that
extensively in C# but I believe you can port that code to D
easily. Here's the code[1]. Hope it's useful.
[1]:
https://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net/9164742#9164742
More information about the Digitalmars-d-learn
mailing list