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

win,test: try again if file unlink fails #284

Merged
merged 1 commit into from
Jan 11, 2015

Conversation

piscisaureus
Copy link
Contributor

Now that parallel tests are enabled, the test runner spits out a ton of
'access denied' errors while running the tests. These happen because a
virus scanner or the indexing service temporarily open the file after it
has been updated, and the test runner tries to unlink() them at the same
time.

This patch resolves this issue by attempting to unlink the file until it
succeeds.

R=@bnoordhuis

@piscisaureus piscisaureus changed the title Test fix unlink win,test: try again if file unlink fails Jan 10, 2015
except OSError, e:
# On Windows unlink() fails if another process has the file open.
# Yield and try again, and it'll succeed.
if os.name == 'nt' and e.errno == errno.EACCES:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.platform == 'win32' is slightly more idiomatic. Maybe the comment could mention that 'another process' means a virus scanner or an indexer because the only two calls to CheckedUnlink() are for temp files. An unwitting reader could easily assume that the loop is not in fact necessary.

Now that parallel tests are enabled, the test runner spits out a ton of
'access denied' errors while running the tests. These happen because a
virus scanner or the indexing service temporarily open the file after it
has been updated, and the test runner tries to unlink() them at the same
time.

This patch resolves this issue by attempting to unlink the file until it
succeeds.

PR-URL: nodejs#284
Reviewed-by: Ben Noordhuis <[email protected]>
@piscisaureus piscisaureus merged commit b57e9a9 into nodejs:v1.x Jan 11, 2015
@piscisaureus piscisaureus deleted the test-fix-unlink branch January 11, 2015 00:55
@bnoordhuis
Copy link
Member

LGTM even if makes me feel a little squeamish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants