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.statSync does not throw an error when accessing non-existent directory on Windows 10 #9106

Closed
balos1 opened this issue Oct 15, 2016 · 5 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@balos1
Copy link

balos1 commented Oct 15, 2016

  • Version: v6.7.0
  • Platform: Windows 10 (64 bit)
  • Subsystem: fs

On Windows 10, I am not getting the same behavior of fs.statSync when trying to access a non-existent directory as I do on Linux. The expected result is for an error to be thrown, which occurs on Linux, but not on Windows 10.

Example:

try {
    var stat = fs.statSync(path_to_missing_dir);
    if (stat.isDirectory()) return true;
} catch (err) { 
    console.log(err.message);  // not reached on windows 10
}
@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. labels Oct 15, 2016
@seishun
Copy link
Contributor

seishun commented Oct 15, 2016

Can't reproduce. Can you provide an example of path_to_missing_dir?

@balos1
Copy link
Author

balos1 commented Oct 15, 2016

The path which I was trying to reach when I came across this problem was C:\\Users\\SomeUser\\Projects\\test\\test_sub\\.git\\.

@seishun
Copy link
Contributor

seishun commented Oct 15, 2016

Are you sure that directory actually doesn't exist and isn't just hidden?

@balos1
Copy link
Author

balos1 commented Oct 15, 2016

Positive it doesn't exist, but I did just try this on another system and can't reproduce... so since I am using nvm-windows to install node, I just upgraded my system to v6.8.0, and the error was properly thrown.

@balos1
Copy link
Author

balos1 commented Oct 15, 2016

OK, reinstalled 6.7.0 on my system and the error is properly thrown now as well. Possibly something was corrupted with my original installation of 6.7.0. Looks like this was a non-issue and can be closed.

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. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

3 participants