Skip to content

Commit

Permalink
lib: remove v8_prof_polyfill from eslint ignore list
Browse files Browse the repository at this point in the history
PR-URL: #36537
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
aduh95 authored and targos committed Jun 11, 2021
1 parent dcd221c commit 9338759
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
test/fixtures
Expand Down
30 changes: 16 additions & 14 deletions lib/internal/v8_prof_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/* eslint-disable no-restricted-globals */
'use strict';

/* eslint-disable node-core/prefer-primordials */
/* global Buffer, console */

module.exports = { versionCheck };

Expand All @@ -37,7 +40,7 @@ if (module.id === 'internal/v8_prof_polyfill') return;
// Node polyfill
const fs = require('fs');
const cp = require('child_process');
const os = {
const os = { // eslint-disable-line no-unused-vars
system: function(name, args) {
if (process.platform === 'linux' && name === 'nm') {
// Filter out vdso and vsyscall entries.
Expand All @@ -51,28 +54,29 @@ const os = {
let out = cp.spawnSync(name, args).stdout.toString();
// Auto c++filt names, but not [iItT]
if (process.platform === 'darwin' && name === 'nm') {
// nm prints an error along the lines of "Run xcodebuild -license" and
// `nm` prints an error along the lines of "Run xcodebuild -license" and
// exits when Xcode hasn't been properly installed or when its license
// hasn't been accepted yet. Basically any mention of xcodebuild in
// the output means the nm command is non-functional.
const match = out.match(/(?:^|\n)([^\n]*xcodebuild[^\n]*)(?:\n|$)/);
// eslint-disable-next-line no-restricted-syntax
if (match) throw new Error(match[1]);
out = macCppfiltNm(out);
}
return out;
}
};
const print = console.log;
function read(fileName) {
const print = console.log; // eslint-disable-line no-unused-vars
function read(fileName) { // eslint-disable-line no-unused-vars
return fs.readFileSync(fileName, 'utf8');
}
const quit = process.exit;
const quit = process.exit; // eslint-disable-line no-unused-vars

// Polyfill "readline()".
const logFile = arguments[arguments.length - 1];
const logFile = arguments[arguments.length - 1]; // eslint-disable-line no-undef
try {
fs.accessSync(logFile);
} catch(e) {
} catch {
console.error('Please provide a valid isolate file as the final argument.');
process.exit(1);
}
Expand Down Expand Up @@ -121,8 +125,8 @@ function versionCheck(firstLine, expected) {
// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
// "$major.$minor.$build.$patch-$embedder".
firstLine = firstLine.split(',');
const curVer = expected.split(/[.\-]/);
if (firstLine.length !== 6 && firstLine.length !== 7 ||
const curVer = expected.split(/[.-]/);
if ((firstLine.length !== 6 && firstLine.length !== 7) ||
firstLine[0] !== 'v8-version') {
return 'Unable to read v8-version from log file.';
}
Expand All @@ -140,13 +144,11 @@ function macCppfiltNm(out) {
if (entries === null)
return out;

entries = entries.map((entry) => {
return entry.replace(CLEAN_RE, '')
});
entries = entries.map((entry) => entry.replace(CLEAN_RE, ''));

let filtered;
try {
filtered = cp.spawnSync('c++filt', [ '-p' , '-i' ], {
filtered = cp.spawnSync('c++filt', [ '-p', '-i' ], {
input: entries.join('\n')
}).stdout.toString();
} catch {
Expand Down

0 comments on commit 9338759

Please sign in to comment.