diff --git a/lib/util/utimes.js b/lib/util/utimes.js index 87f4588c..434b3cea 100644 --- a/lib/util/utimes.js +++ b/lib/util/utimes.js @@ -4,23 +4,24 @@ const fs = require('../fs') const u = require('universalify').fromPromise async function utimesMillis (path, atime, mtime) { - // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) const fd = await fs.open(path, 'r+') - let closeErr = null + let error = null try { await fs.futimes(fd, atime, mtime) + } catch (futimesErr) { + error = futimesErr } finally { try { await fs.close(fd) - } catch (e) { - closeErr = e + } catch (closeErr) { + error = closeErr } } - if (closeErr) { - throw closeErr + if (error) { + throw error } }