diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 0839e352cd399d..e73e97dede44af 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -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] diff --git a/test/common/index.js b/test/common/index.js index e8546db3a2f4ea..8ffeda42dfd52c 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -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) {