Strange fs.stat error results (Windows 0.5.10) #1927

Closed
geoffreak opened this Issue Oct 24, 2011 · 1 comment

2 participants

@geoffreak

The following code produces vary different results on both Windows (0.5.10) and Mac (0.4.12) when run on an non-existent directory:

util = require('util');
require('fs').stat('/directory/does/not/exist', function(err, stat){
    console.log(util.inspect(err));
    console.log(util.inspect(stat));
});

Mac (0.4.12) - expected results

{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: 'ENOENT, No such file or directory \'/directory/does/not/exist\'',
  errno: 2,
  code: 'ENOENT',
  path: '/directory/does/not/exist' }
undefined

Windows (0.5.10) - unexpected results

{ [ Error: ENOENT, The operation completed successfully.
 '/directory/does/not/exist'] errno: 32, code: 'ENOENT', path: '/directory/does/not/exist' }
undefined

I don't currently have 0.5.10 installed on my Mac to confirm the results there.

Surely the 0.5.10 results are a bug?

@koichik

Because all properties of an Error are non-enumerable since Node v0.5.1 (v8 3.4), the format of an Error has changed.
See also #1634.

@koichik koichik closed this Oct 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment