You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
579 B

'use strict';
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
let caughtException = false;
try {
// should throw ENOENT, not EBADF
// see https://github.com/joyent/node/pull/1228
fs.openSync('/path/to/file/that/does/not/exist', 'r');
} catch (e) {
assert.strictEqual(e.code, 'ENOENT');
caughtException = true;
}
assert.strictEqual(caughtException, true);
fs.open(__filename, 'r', common.mustCall((err) => {
assert.ifError(err);
}));
fs.open(__filename, 'rs', common.mustCall((err) => {
assert.ifError(err);
}));