Author Topic: An application run by TProcess made a file that could not be deleted.  (Read 232 times)

user5

  • Sr. Member
  • ****
  • Posts: 428
    The following problem has only happened to me once. My program was using TProcess to run an application that extracts frames from
a video. One of the frames that it produced could not be deleted until I used Task Manager to stop the application. I think the problem
happened with the application, not with TProcess since only the application was shown in Task Manager. Any suggestions?

Thaddy

  • Hero Member
  • *****
  • Posts: 19978
  • Pointless static linking author
Re: An application run by TProcess made a file that could not be deleted.
« Reply #1 on: October 08, 2026, 02:20:50 pm »
TProcess has an ownership property for that:
https://www.freepascal.org/docs-html/fcl/process/tprocessoptions.html poDetached.
Be careful with that, because if you apply that, the process is not isolated to your application.
« Last Edit: October 08, 2026, 02:22:28 pm by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

user5

  • Sr. Member
  • ****
  • Posts: 428
Re: An application run by TProcess made a file that could not be deleted.
« Reply #2 on: October 08, 2026, 08:52:36 pm »
    I just wanted my program to check to see if the TProcess was still running the application.
    I suppose that I could use "if AProcess.Running then AProcess.Terminate(0)" and perhaps I will.

 

TinyPortal © 2005-2018