Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/util/utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Loading