Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go clean -i doesn't report failure to delete executable files that are in use on Windows #4208

Closed
anacrolix opened this issue Oct 8, 2012 · 8 comments
Milestone

Comments

@anacrolix
Copy link
Contributor

Running `go clean -i` won't remove an executable file that's currently in use on Windows.
@robpike
Copy link
Contributor

robpike commented Oct 8, 2012

Comment 1:

Does it at least tell you of this failure?

@alexbrainman
Copy link
Member

Comment 2:

Please, provide steps to demonstrate: what you do, what you see, what is unexpected. I
am not clear what your problem is. Thank you.
Alex

Status changed to WaitingForReply.

@anacrolix
Copy link
Contributor Author

Comment 3:

No, it silently succeeds. Here's a little snippet:
C:\Users\matt>go clean -i -x bitbucket.org/anacrolix/dms/dms-gtk-gui
cd d:\gopath\src\bitbucket.org\anacrolix\dms\dms-gtk-gui
rm -f dms-gtk-gui dms-gtk-gui.exe dms-gtk-gui.test dms-gtk-gui.test.exe main mai
n.exe
rm -f d:\gopath\bin\dms-gtk-gui.exe
C:\Users\matt>go install -v -ldflags -Hwindowsgui bitbucket.org/anacrolix/dms/dm
s-gtk-gui
The file is still there (I'm running the executable it's trying to delete). Later, it
doesn't bother to install because the file is still present.

@minux
Copy link
Member

minux commented Oct 8, 2012

Comment 4:

not sure how to fix this issue, cmd/go ignores error when removing files
to avoid displaying nonsense errors like "remove bin/gofmt: no such file or directory"
(that is, effectively 'rm -rf files')

@alexbrainman
Copy link
Member

Comment 5:

I see what your problem is. But I do not know what to do.
Like minux says, we ignore errors from os.Remove. I suspect, the reasoning is that too
many false positives. Also we can't do much about them anyway. But I can see its effect
on windows - linux would remove the file regardless whether you are running it or not,
but windows is picky in that situation.
I think, the best we could do here is warn you about the problem. Perhaps we could check
os.Remove error for os.IsNotExist. We should skip the once that match os.IsNotExist, but
display the others.
I am not certain, it will look. So leaving it for others to decide.
Alex

Labels changed: added os-windows.

Status changed to Thinking.

@ianlancetaylor
Copy link
Contributor

Comment 6:

I agree that the right thing to do is ignore success and os.IsNotExist errors, and
report other errors.  That would correspond to how "rm -f" behaves on Unix.

@minux
Copy link
Member

minux commented Oct 10, 2012

Comment 7:

https://golang.org/cl/6635064/

Owner changed to @minux.

Status changed to Started.

@minux
Copy link
Member

minux commented Oct 10, 2012

Comment 8:

This issue was closed by revision bf7d229.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants