Skip to content
Closed
Show file tree
Hide file tree
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
tools: enable no-unsafe-finally
This enables the `no-unsafe-finally` eslint rule to make sure we
have a proper control flow in try / catch.

PR-URL: #18745
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR committed Mar 21, 2018
commit a60b423a75fe3c0e26f120afc0d9d03676b8024a
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ rules:
}]
no-tabs: error
no-trailing-spaces: error
no-unsafe-finally: error
object-curly-spacing: [error, always]
one-var-declaration-per-line: error
operator-linebreak: [error, after]
Expand Down
32 changes: 16 additions & 16 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,24 @@ function tryOnTimeout(timer, list) {
}
}

if (!threw) return;

// Postpone all later list events to next tick. We need to do this
// so that the events are called in the order they were created.
const lists = list._unrefed === true ? unrefedLists : refedLists;
for (var key in lists) {
if (key > list.msecs) {
lists[key].nextTick = true;
if (threw) {
// Postpone all later list events to next tick. We need to do this
// so that the events are called in the order they were created.
const lists = list._unrefed === true ? unrefedLists : refedLists;
for (var key in lists) {
if (key > list.msecs) {
lists[key].nextTick = true;
}
}
// We need to continue processing after domain error handling
// is complete, but not by using whatever domain was left over
// when the timeout threw its exception.
const domain = process.domain;
process.domain = null;
// If we threw, we need to process the rest of the list in nextTick.
process.nextTick(listOnTimeoutNT, list);
process.domain = domain;
}
// We need to continue processing after domain error handling
// is complete, but not by using whatever domain was left over
// when the timeout threw its exception.
const domain = process.domain;
process.domain = null;
// If we threw, we need to process the rest of the list in nextTick.
process.nextTick(listOnTimeoutNT, list);
process.domain = domain;
}
}

Expand Down
14 changes: 3 additions & 11 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,21 +514,13 @@ exports.canCreateSymLink = function() {
const whoamiPath = path.join(process.env.SystemRoot,
'System32', 'whoami.exe');

let err = false;
let output = '';

try {
output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
const output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
return output.includes('SeCreateSymbolicLinkPrivilege');
} catch (e) {
err = true;
} finally {
if (err || !output.includes('SeCreateSymbolicLinkPrivilege')) {
return false;
}
return false;
}
}

return true;
};

exports.getCallSite = function getCallSite(top) {
Expand Down