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

fs.watchFile calling listener on non-existing files #1745

Closed
kanongil opened this issue May 20, 2015 · 3 comments
Closed

fs.watchFile calling listener on non-existing files #1745

kanongil opened this issue May 20, 2015 · 3 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@kanongil
Copy link
Contributor

fs.watchFile is supposed to call the listener when the file attributes change. If I call it using a non-existing path, the listener is immediately fired for some reason.

In node 0.10, it would wait until the file exists before calling the listener. The current functionality does however match node 0.12 behavior, which I filed an issue again here: nodejs/node-v0.x-archive#25345.

@Fishrock123 Fishrock123 added the fs Issues and PRs related to the fs subsystem / file system. label May 20, 2015
@brendanashworth
Copy link
Contributor

There is a fix pending here: nodejs/node-v0.x-archive#25469

@brendanashworth brendanashworth added the confirmed-bug Issues with confirmed bugs. label Jun 7, 2015
brendanashworth pushed a commit to brendanashworth/io.js that referenced this issue Jun 22, 2015
Previously, fs.watchFile() would call the callback even if the file does
not exist. This is erroneous and is fixed by correctly handling the
error code provided.

Ref: nodejs/node-v0.x-archive#25469
Fixes: nodejs#1745
@brendanashworth
Copy link
Contributor

@kanongil according to some discussion (#2028 (comment)), some believe that this should be the correct functionality. Do you have an opinion on that?

@brendanashworth brendanashworth removed the confirmed-bug Issues with confirmed bugs. label Jul 2, 2015
brendanashworth added a commit to brendanashworth/io.js that referenced this issue Jul 10, 2015
When fs.watchFile encounters an ENOENT error, it invokes the given
callback with some error data. This caused an issue as it was different
behaviour than Node v0.10. Instead of changing this behaviour, document
it and add a test.

Ref: nodejs#1745
Ref: nodejs#2028
brendanashworth added a commit that referenced this issue Jul 10, 2015
When fs.watchFile encounters an ENOENT error, it invokes the given
callback with some error data. This caused an issue as it was different
behaviour than Node v0.10. Instead of changing this behaviour, document
it and add a test.

Ref: #1745
Ref: #2028
Reviewed-By: Ben Noordhuis <[email protected]>
PR-URL: #2093
@thefourtheye
Copy link
Contributor

@kanongil As per the discussion here, the current behaviour is preferred. And the doc improvement is done in #2093 and #2169. Please feel free to review them and suggest changes. I am closing this issue now. Please leave a comment if you strongly feel that this has to be reopened and discussed further. Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
4 participants