Most programs that use auto-update features use a different executable file to execute to avoid this problem.
However, I see a somewhat simple solution:
old programuploads new programto a temporary locationold programstarts new program(possibly with a special parameter) and exits itselfnew programcopies itself on top old program(it should be normal for the running program to read itself if it is not open for writing)new programstarts new program (copy)with a special argument and then exits itselfnew program (copy)deletes new programand resumes normal operations
Is this clear enough? :)
source
share