Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tmpdir: inline error logging function
  • Loading branch information
RaisinTen committed Jun 5, 2021
commit a766a75bd72c7a0019aae25bfcb8e6679d7ff989
38 changes: 17 additions & 21 deletions test/common/tmpdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,6 @@ function refresh() {
}
}

function logErrorInfo(err) {
console.error('Can\'t clean tmpdir:', tmpPath);

const files = fs.readdirSync(tmpPath);
console.error('Files blocking:', files);

if (files.some((f) => f.startsWith('.nfs'))) {
// Warn about NFS "silly rename"
console.error('Note: ".nfs*" might be files that were open and ' +
'unlinked but not closed.');
console.error('See http://nfs.sourceforge.net/#faq_d2 for details.');
}

// Additionally logging err, just in case throwing err gets overshadowed by
// an error from a test failure.
console.error(err);

throw err;
}

function onexit() {
// Change directory to avoid possible EBUSY
if (isMainThread)
Expand All @@ -81,7 +61,23 @@ function onexit() {
try {
rmSync(tmpPath);
} catch (err) {
logErrorInfo(err);
console.error('Can\'t clean tmpdir:', tmpPath);

const files = fs.readdirSync(tmpPath);
console.error('Files blocking:', files);

if (files.some((f) => f.startsWith('.nfs'))) {
// Warn about NFS "silly rename"
console.error('Note: ".nfs*" might be files that were open and ' +
'unlinked but not closed.');
console.error('See http://nfs.sourceforge.net/#faq_d2 for details.');
}

// Additionally logging err, just in case throwing err gets overshadowed by
// an error from a test failure.
console.error(err);

throw err;
}
}

Expand Down