2525// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
28- /* eslint-disable no-restricted-globals */
28+ 'use strict' ;
29+
30+ /* eslint-disable node-core/prefer-primordials */
31+ /* global Buffer, console */
2932
3033module . exports = { versionCheck } ;
3134
@@ -37,7 +40,7 @@ if (module.id === 'internal/v8_prof_polyfill') return;
3740// Node polyfill
3841const fs = require ( 'fs' ) ;
3942const cp = require ( 'child_process' ) ;
40- const os = {
43+ const os = { // eslint-disable-line no-unused-vars
4144system : function ( name , args ) {
4245if ( process . platform === 'linux' && name === 'nm' ) {
4346// Filter out vdso and vsyscall entries.
@@ -51,28 +54,29 @@ const os = {
5154let out = cp . spawnSync ( name , args ) . stdout . toString ( ) ;
5255// Auto c++filt names, but not [iItT]
5356if ( process . platform === 'darwin' && name === 'nm' ) {
54- // nm prints an error along the lines of "Run xcodebuild -license" and
57+ // `nm` prints an error along the lines of "Run xcodebuild -license" and
5558// exits when Xcode hasn't been properly installed or when its license
5659// hasn't been accepted yet. Basically any mention of xcodebuild in
5760// the output means the nm command is non-functional.
5861const match = out . match ( / (?: ^ | \n ) ( [ ^ \n ] * x c o d e b u i l d [ ^ \n ] * ) (?: \n | $ ) / ) ;
62+ // eslint-disable-next-line no-restricted-syntax
5963if ( match ) throw new Error ( match [ 1 ] ) ;
6064out = macCppfiltNm ( out ) ;
6165}
6266return out ;
6367}
6468} ;
65- const print = console . log ;
66- function read ( fileName ) {
69+ const print = console . log ; // eslint-disable-line no-unused-vars
70+ function read ( fileName ) { // eslint-disable-line no-unused-vars
6771return fs . readFileSync ( fileName , 'utf8' ) ;
6872}
69- const quit = process . exit ;
73+ const quit = process . exit ; // eslint-disable-line no-unused-vars
7074
7175// Polyfill "readline()".
72- const logFile = arguments [ arguments . length - 1 ] ;
76+ const logFile = arguments [ arguments . length - 1 ] ; // eslint-disable-line no-undef
7377try {
7478fs . accessSync ( logFile ) ;
75- } catch ( e ) {
79+ } catch {
7680console . error ( 'Please provide a valid isolate file as the final argument.' ) ;
7781process . exit ( 1 ) ;
7882}
@@ -121,8 +125,8 @@ function versionCheck(firstLine, expected) {
121125// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
122126// "$major.$minor.$build.$patch-$embedder".
123127firstLine = firstLine . split ( ',' ) ;
124- const curVer = expected . split ( / [ . \ -] / ) ;
125- if ( firstLine . length !== 6 && firstLine . length !== 7 ||
128+ const curVer = expected . split ( / [ . - ] / ) ;
129+ if ( ( firstLine . length !== 6 && firstLine . length !== 7 ) ||
126130firstLine [ 0 ] !== 'v8-version' ) {
127131return 'Unable to read v8-version from log file.' ;
128132}
@@ -140,13 +144,11 @@ function macCppfiltNm(out) {
140144if ( entries === null )
141145return out ;
142146
143- entries = entries . map ( ( entry ) => {
144- return entry . replace ( CLEAN_RE , '' )
145- } ) ;
147+ entries = entries . map ( ( entry ) => entry . replace ( CLEAN_RE , '' ) ) ;
146148
147149let filtered ;
148150try {
149- filtered = cp . spawnSync ( 'c++filt' , [ '-p' , '-i' ] , {
151+ filtered = cp . spawnSync ( 'c++filt' , [ '-p' , '-i' ] , {
150152input : entries . join ( '\n' )
151153} ) . stdout . toString ( ) ;
152154} catch {
0 commit comments