Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flakiness in test_futimens_rawfs #22476

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion src/library_noderawfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ addToLibrary({
var stream = FS.getStreamChecked(fd);
fs.ftruncateSync(stream.nfd, len);
},
utime(path, atime, mtime) { fs.utimesSync(path, atime/1000, mtime/1000); },
utime(path, atime, mtime) {
// -1 here for atime or mtime means UTIME_OMIT was passed. Since node
// doesn't support this concept we need to first find the existing
// timestamps in order to preserve them.
if (atime == -1 || mtime == -1) {
var st = fs.statSync(path);
if (atime == -1) atime = st.atimeMs;
if (mtime == -1) mtime = st.mtimeMs;
}
fs.utimesSync(path, atime/1000, mtime/1000);
},
open(path, flags, mode) {
if (typeof flags == "string") {
flags = FS_modeStringToFlags(flags)
Expand Down
Loading