11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst fs = require('fs'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// Test that using FileHandle.close to close an already-closed fd fails 71cb0ef41Sopenharmony_ci// with EBADF. 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci(async function() { 101cb0ef41Sopenharmony_ci const fh = await fs.promises.open(__filename); 111cb0ef41Sopenharmony_ci fs.closeSync(fh.fd); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci assert.rejects(() => fh.close(), { 141cb0ef41Sopenharmony_ci code: 'EBADF', 151cb0ef41Sopenharmony_ci syscall: 'close' 161cb0ef41Sopenharmony_ci }); 171cb0ef41Sopenharmony_ci})().then(common.mustCall()); 18