Hello dear fellow gophers, 

I had a relatively simple yet quite inconvenient issue which I felt the 
need to ask here. In my main() function;

os.Remove("my.exe") // err is nil, my.exe is removed

works in Windows without any errors, but when I call exec beforehand, I get 
access is denied error;

buffer, err := exec.Command("my.exe", myArgs...).Output() // err is nil 
here, I get desired output
os.Remove("my.exe") // remove "C:\\.......\my.exe": Access is denied

I tried using cmd.Process.Kill(), cmd.Process.Wait(), 
cmd.Start()-ioutil.ReadlAll()-cmd.Wait() alternatives as well. I kept 
getting no errors until 'Access is denied'. 

I'm using go1.14 linux/amd64 for my compiler and Windows 10 Enterprise 
10.0.18362.

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6b88ac39-f0a1-4eee-92d1-e63d8b55261do%40googlegroups.com.

Reply via email to