25
25
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
26
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
28
- /* eslint-disable no-restricted-globals */
28
+ 'use strict' ;
29
+
30
+ /* eslint-disable node-core/prefer-primordials */
31
+ /* global Buffer, console */
29
32
30
33
module . exports = { versionCheck } ;
31
34
@@ -37,7 +40,7 @@ if (module.id === 'internal/v8_prof_polyfill') return;
37
40
// Node polyfill
38
41
const fs = require ( 'fs' ) ;
39
42
const cp = require ( 'child_process' ) ;
40
- const os = {
43
+ const os = { // eslint-disable-line no-unused-vars
41
44
system : function ( name , args ) {
42
45
if ( process . platform === 'linux' && name === 'nm' ) {
43
46
// Filter out vdso and vsyscall entries.
@@ -51,28 +54,29 @@ const os = {
51
54
let out = cp . spawnSync ( name , args ) . stdout . toString ( ) ;
52
55
// Auto c++filt names, but not [iItT]
53
56
if ( 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
55
58
// exits when Xcode hasn't been properly installed or when its license
56
59
// hasn't been accepted yet. Basically any mention of xcodebuild in
57
60
// the output means the nm command is non-functional.
58
61
const 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
59
63
if ( match ) throw new Error ( match [ 1 ] ) ;
60
64
out = macCppfiltNm ( out ) ;
61
65
}
62
66
return out ;
63
67
}
64
68
} ;
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
67
71
return fs . readFileSync ( fileName , 'utf8' ) ;
68
72
}
69
- const quit = process . exit ;
73
+ const quit = process . exit ; // eslint-disable-line no-unused-vars
70
74
71
75
// Polyfill "readline()".
72
- const logFile = arguments [ arguments . length - 1 ] ;
76
+ const logFile = arguments [ arguments . length - 1 ] ; // eslint-disable-line no-undef
73
77
try {
74
78
fs . accessSync ( logFile ) ;
75
- } catch ( e ) {
79
+ } catch {
76
80
console . error ( 'Please provide a valid isolate file as the final argument.' ) ;
77
81
process . exit ( 1 ) ;
78
82
}
@@ -121,8 +125,8 @@ function versionCheck(firstLine, expected) {
121
125
// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
122
126
// "$major.$minor.$build.$patch-$embedder".
123
127
firstLine = 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 ) ||
126
130
firstLine [ 0 ] !== 'v8-version' ) {
127
131
return 'Unable to read v8-version from log file.' ;
128
132
}
@@ -140,13 +144,11 @@ function macCppfiltNm(out) {
140
144
if ( entries === null )
141
145
return out ;
142
146
143
- entries = entries . map ( ( entry ) => {
144
- return entry . replace ( CLEAN_RE , '' )
145
- } ) ;
147
+ entries = entries . map ( ( entry ) => entry . replace ( CLEAN_RE , '' ) ) ;
146
148
147
149
let filtered ;
148
150
try {
149
- filtered = cp . spawnSync ( 'c++filt' , [ '-p' , '-i' ] , {
151
+ filtered = cp . spawnSync ( 'c++filt' , [ '-p' , '-i' ] , {
150
152
input : entries . join ( '\n' )
151
153
} ) . stdout . toString ( ) ;
152
154
} catch {
0 commit comments