Closed
Description
The following test case opens a file, and closes it twice expecting to get an Error.
var assert = require('assert');
var fs = require('fs');
// 'w+' - Open file for reading and writing.
// The file is created (if it does not exist)
// or truncated (if it exists).
fs.open(__dirname + '/test-to-open-a-file.txt', 'w+', function(err1, fd){
console.log('open', fd);
fs.close(fd, function(err2){
console.log('close - should have no error', fd);
assert.ifError(err2);
fs.close(fd, function(err3){
console.log('close2 - expect an error', fd);
console.error(err3);
});
});
});
On Linux/Mac the second close callback err3 has the following Error: { [Error: EBADF: bad file descriptor, close] errno: -9, code: 'EBADF', syscall: 'close' }
On Windows 10 the second callback err3 has null