mirror of https://github.com/lukechilds/node.git
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.
39 lines
714 B
39 lines
714 B
14 years ago
|
var constants = require('constants');
|
||
14 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
|
var fs = require('fs');
|
||
|
|
||
14 years ago
|
var caughtException = false;
|
||
|
try {
|
||
13 years ago
|
// should throw ENOENT, not EBADF
|
||
|
// see https://github.com/joyent/node/pull/1228
|
||
14 years ago
|
fs.openSync('/path/to/file/that/does/not/exist', 'r');
|
||
|
}
|
||
|
catch (e) {
|
||
14 years ago
|
assert.equal(e.code, 'ENOENT');
|
||
14 years ago
|
caughtException = true;
|
||
|
}
|
||
|
assert.ok(caughtException);
|
||
|
|
||
14 years ago
|
var openFd;
|
||
|
fs.open(__filename, 'r', function(err, fd) {
|
||
|
if (err) {
|
||
|
throw err;
|
||
|
}
|
||
|
openFd = fd;
|
||
|
});
|
||
|
|
||
13 years ago
|
var openFd2;
|
||
|
fs.open(__filename, 'rs', function(err, fd) {
|
||
|
if (err) {
|
||
|
throw err;
|
||
|
}
|
||
|
openFd2 = fd;
|
||
|
});
|
||
|
|
||
13 years ago
|
process.on('exit', function() {
|
||
14 years ago
|
assert.ok(openFd);
|
||
13 years ago
|
assert.ok(openFd2);
|
||
14 years ago
|
});
|
||
|
|