26
26
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
28
28
// Node polyfill
29
- var fs = require ( 'fs' ) ;
30
- var os = {
29
+ const fs = require ( 'fs' ) ;
30
+ const cp = require ( 'child_process' ) ;
31
+ const os = {
31
32
system : function ( name , args ) {
32
33
if ( process . platform === 'linux' && name === 'nm' ) {
33
34
// Filter out vdso and vsyscall entries.
34
- var arg = args [ args . length - 1 ] ;
35
+ const arg = args [ args . length - 1 ] ;
35
36
if ( arg === '[vdso]' ||
36
37
arg == '[vsyscall]' ||
37
38
/ ^ [ 0 - 9 a - f ] + - [ 0 - 9 a - f ] + $ / . test ( arg ) ) {
38
39
return '' ;
39
40
}
41
+ } else if ( process . platform === 'darwin' ) {
42
+ args . unshift ( '-c' , name ) ;
43
+ name = '/bin/sh' ;
40
44
}
41
- return require ( 'child_process' ) . execFileSync (
42
- name , args , { encoding : 'utf8' } ) ;
45
+ return cp . spawnSync ( name , args ) . stdout . toString ( ) ;
43
46
}
44
47
} ;
45
- var print = console . log ;
48
+ const print = console . log ;
46
49
function read ( fileName ) {
47
50
return fs . readFileSync ( fileName , 'utf8' ) ;
48
51
}
49
- arguments = process . argv . slice ( 2 ) ;
50
- var quit = process . exit ;
52
+ const quit = process . exit ;
51
53
52
54
// Polyfill "readline()".
53
- var logFile = arguments [ arguments . length - 1 ] ;
55
+ const logFile = arguments [ arguments . length - 1 ] ;
54
56
try {
55
57
fs . accessSync ( logFile ) ;
56
58
} catch ( e ) {
57
59
console . error ( 'Please provide a valid isolate file as the final argument.' ) ;
58
60
process . exit ( 1 ) ;
59
61
}
60
- var fd = fs . openSync ( logFile , 'r' ) ;
61
- var buf = new Buffer ( 4096 ) ;
62
- var dec = new ( require ( 'string_decoder' ) . StringDecoder ) ( 'utf-8' ) ;
62
+ const fd = fs . openSync ( logFile , 'r' ) ;
63
+ const buf = new Buffer ( 4096 ) ;
64
+ const dec = new ( require ( 'string_decoder' ) . StringDecoder ) ( 'utf-8' ) ;
63
65
var line = '' ;
64
66
versionCheck ( ) ;
65
67
function readline ( ) {
@@ -85,7 +87,7 @@ function versionCheck() {
85
87
var firstLine = readline ( ) ;
86
88
line = firstLine + '\n' + line ;
87
89
firstLine = firstLine . split ( ',' ) ;
88
- var curVer = process . versions . v8 . split ( '.' ) ;
90
+ const curVer = process . versions . v8 . split ( '.' ) ;
89
91
if ( firstLine . length !== 6 && firstLine [ 0 ] !== 'v8-version' ) {
90
92
console . log ( 'Unable to read v8-version from log file.' ) ;
91
93
return ;
0 commit comments