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

tools: enable no-unsafe-finally #18745

Closed
wants to merge 2 commits into from
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
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 4 additions & 8 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +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 });
} catch (e) {
err = true;
} finally {
if (err || !output.includes('SeCreateSymbolicLinkPrivilege')) {
const output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
if (!output.includes('SeCreateSymbolicLinkPrivilege')) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to just this, I think?

return output.includes('SeCreateSymbolicLinkPrivilege');

And then you don't need the return true a few lines below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yepp, absolutely

} catch (e) {
return false;
}
}

Expand Down