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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
d8d84eee18
commit
4d3c3f039a
@ -152,6 +152,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]
|
||||
|
@ -504,21 +504,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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user