Adding to my previous post...
My expectation of a "process wait" is that it returns when the process is
finished executing. I don't think it necessarily means that the OS has
released the executable file. In Windows, this is clearly the case. It's
unfortunate that the Windows characteristic that a
Thank you for your reply.
It was refreshing to hear that this issue had been discovered earlier and
some work has been put into it. I guess I will keep a loop for n times and
fail if still can't delete it for a while.
Cheers.
16 Ağustos 2020 Pazar tarihinde saat 21:28:26 UTC+3 itibarıyla
bob
Note that the "retry loop for deleting the executable" technique has zero
wait time if the delete succeeds.
A year or so ago I submitted a bug report because I had a program that ran
hundreds of external processes (one at a time), and my Go program was way
slower that a Python program that did the
Here's what I think is really going on:
At the end of a process's execution, 2 things happen:
- The process's code finishes its execution -- wait returns.
- The OS closes the executable file.
The second item always "comes after" the first. On Windows the delay might
be a few milliseconds, wh
> Turns out it takes some time to release the lock on the folder, so we
should do some time.Sleep before the os.Remove, so that Windows can release
the lock.
I do not believe that should be the case under normal Windows operation.
Using a Sleep in a case like this is always a hack. Sometimes
Hello guys, I have solved the issue.
Turns out it takes some time to release the lock on the folder, so we
should do some time.Sleep before the os.Remove, so that Windows can release
the lock.
Thank you both for replying.
14 Ağustos 2020 Cuma tarihinde saat 16:21:17 UTC+3 itibarıyla
jake...@
This works fine for me on Windows 10.
What is "my.exe" doing?
Do you have third party antivirus software? If so, try turning it off. They
are notorious for causing this kind of problem.
On Friday, August 14, 2020 at 5:02:36 AM UTC-4 atakanc...@gmail.com wrote:
> Hello dear fellow gophers,
>
Thank you for your reply. Unfortunately taskkill returns 128
buffer, err := exec.Command("my.exe", myArgs...).Output() // err is nil
here, I get desired output
_, err := exec.Command("taskkill", "/F", "/im", "my.exe").Output() // err
is exit code 128, tried same with /pid, cmd.Process.Pid as we
Windows locks the running program's file, you cannot delete it when it's
running - use "taskkill /F" to kill it proper.
atakanc...@gmail.com a következőt írta (2020. augusztus 14., péntek,
11:02:36 UTC+2):
> Hello dear fellow gophers,
>
> I had a relatively simple yet quite inconvenient issue