asar.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. (function () {
  2. const asar = process.binding('atom_common_asar')
  3. const {Buffer} = require('buffer')
  4. const childProcess = require('child_process')
  5. const path = require('path')
  6. const util = require('util')
  7. const hasProp = {}.hasOwnProperty
  8. // Cache asar archive objects.
  9. const cachedArchives = {}
  10. const envNoAsar = process.env.ELECTRON_NO_ASAR && process.type !== 'browser' && process.type !== 'renderer'
  11. const isAsarDisabled = function () {
  12. return process.noAsar || envNoAsar
  13. }
  14. const getOrCreateArchive = function (p) {
  15. let archive = cachedArchives[p]
  16. if (archive != null) {
  17. return archive
  18. }
  19. archive = asar.createArchive(p)
  20. if (!archive) {
  21. return false
  22. }
  23. cachedArchives[p] = archive
  24. return archive
  25. }
  26. // Clean cache on quit.
  27. process.on('exit', function () {
  28. for (let p in cachedArchives) {
  29. if (!hasProp.call(cachedArchives, p)) continue
  30. cachedArchives[p].destroy()
  31. }
  32. })
  33. // Separate asar package's path from full path.
  34. const splitPath = function (p) {
  35. // shortcut to disable asar.
  36. if (isAsarDisabled()) {
  37. return [false]
  38. }
  39. if (Buffer.isBuffer(p)) {
  40. p = p.toString()
  41. }
  42. if (typeof p !== 'string') {
  43. return [false]
  44. }
  45. if (p.substr(-5) === '.asar') {
  46. return [true, p, '']
  47. }
  48. p = path.normalize(p)
  49. const index = p.lastIndexOf('.asar' + path.sep)
  50. if (index === -1) {
  51. return [false]
  52. }
  53. return [true, p.substr(0, index + 5), p.substr(index + 6)]
  54. }
  55. // Convert asar archive's Stats object to fs's Stats object.
  56. let nextInode = 0
  57. const uid = process.getuid != null ? process.getuid() : 0
  58. const gid = process.getgid != null ? process.getgid() : 0
  59. const fakeTime = new Date()
  60. const asarStatsToFsStats = function (stats) {
  61. return {
  62. dev: 1,
  63. ino: ++nextInode,
  64. mode: 33188,
  65. nlink: 1,
  66. uid: uid,
  67. gid: gid,
  68. rdev: 0,
  69. atime: stats.atime || fakeTime,
  70. birthtime: stats.birthtime || fakeTime,
  71. mtime: stats.mtime || fakeTime,
  72. ctime: stats.ctime || fakeTime,
  73. size: stats.size,
  74. isFile: function () {
  75. return stats.isFile
  76. },
  77. isDirectory: function () {
  78. return stats.isDirectory
  79. },
  80. isSymbolicLink: function () {
  81. return stats.isLink
  82. },
  83. isBlockDevice: function () {
  84. return false
  85. },
  86. isCharacterDevice: function () {
  87. return false
  88. },
  89. isFIFO: function () {
  90. return false
  91. },
  92. isSocket: function () {
  93. return false
  94. }
  95. }
  96. }
  97. // Create a ENOENT error.
  98. const notFoundError = function (asarPath, filePath, callback) {
  99. const error = new Error(`ENOENT, ${filePath} not found in ${asarPath}`)
  100. error.code = 'ENOENT'
  101. error.errno = -2
  102. if (typeof callback !== 'function') {
  103. throw error
  104. }
  105. process.nextTick(function () {
  106. callback(error)
  107. })
  108. }
  109. // Create a ENOTDIR error.
  110. const notDirError = function (callback) {
  111. const error = new Error('ENOTDIR, not a directory')
  112. error.code = 'ENOTDIR'
  113. error.errno = -20
  114. if (typeof callback !== 'function') {
  115. throw error
  116. }
  117. process.nextTick(function () {
  118. callback(error)
  119. })
  120. }
  121. // Create a EACCES error.
  122. const accessError = function (asarPath, filePath, callback) {
  123. const error = new Error(`EACCES: permission denied, access '${filePath}'`)
  124. error.code = 'EACCES'
  125. error.errno = -13
  126. if (typeof callback !== 'function') {
  127. throw error
  128. }
  129. process.nextTick(function () {
  130. callback(error)
  131. })
  132. }
  133. // Create invalid archive error.
  134. const invalidArchiveError = function (asarPath, callback) {
  135. const error = new Error(`Invalid package ${asarPath}`)
  136. if (typeof callback !== 'function') {
  137. throw error
  138. }
  139. process.nextTick(function () {
  140. callback(error)
  141. })
  142. }
  143. // Override APIs that rely on passing file path instead of content to C++.
  144. const overrideAPISync = function (module, name, arg) {
  145. if (arg == null) {
  146. arg = 0
  147. }
  148. const old = module[name]
  149. module[name] = function () {
  150. const p = arguments[arg]
  151. const [isAsar, asarPath, filePath] = splitPath(p)
  152. if (!isAsar) {
  153. return old.apply(this, arguments)
  154. }
  155. const archive = getOrCreateArchive(asarPath)
  156. if (!archive) {
  157. invalidArchiveError(asarPath)
  158. }
  159. const newPath = archive.copyFileOut(filePath)
  160. if (!newPath) {
  161. notFoundError(asarPath, filePath)
  162. }
  163. arguments[arg] = newPath
  164. return old.apply(this, arguments)
  165. }
  166. }
  167. const overrideAPI = function (module, name, arg) {
  168. if (arg == null) {
  169. arg = 0
  170. }
  171. const old = module[name]
  172. module[name] = function () {
  173. const p = arguments[arg]
  174. const [isAsar, asarPath, filePath] = splitPath(p)
  175. if (!isAsar) {
  176. return old.apply(this, arguments)
  177. }
  178. const callback = arguments[arguments.length - 1]
  179. if (typeof callback !== 'function') {
  180. return overrideAPISync(module, name, arg)
  181. }
  182. const archive = getOrCreateArchive(asarPath)
  183. if (!archive) {
  184. return invalidArchiveError(asarPath, callback)
  185. }
  186. const newPath = archive.copyFileOut(filePath)
  187. if (!newPath) {
  188. return notFoundError(asarPath, filePath, callback)
  189. }
  190. arguments[arg] = newPath
  191. return old.apply(this, arguments)
  192. }
  193. if (old[util.promisify.custom]) {
  194. module[name][util.promisify.custom] = function () {
  195. const p = arguments[arg]
  196. const [isAsar, asarPath, filePath] = splitPath(p)
  197. if (!isAsar) {
  198. return old[util.promisify.custom].apply(this, arguments)
  199. }
  200. const archive = getOrCreateArchive(asarPath)
  201. if (!archive) {
  202. return new Promise(() => invalidArchiveError(asarPath))
  203. }
  204. const newPath = archive.copyFileOut(filePath)
  205. if (!newPath) {
  206. return new Promise(() => notFoundError(asarPath, filePath))
  207. }
  208. arguments[arg] = newPath
  209. return old[util.promisify.custom].apply(this, arguments)
  210. }
  211. }
  212. }
  213. // Override fs APIs.
  214. exports.wrapFsWithAsar = function (fs) {
  215. const logFDs = {}
  216. const logASARAccess = function (asarPath, filePath, offset) {
  217. if (!process.env.ELECTRON_LOG_ASAR_READS) {
  218. return
  219. }
  220. if (!logFDs[asarPath]) {
  221. const path = require('path')
  222. const logFilename = path.basename(asarPath, '.asar') + '-access-log.txt'
  223. const logPath = path.join(require('os').tmpdir(), logFilename)
  224. logFDs[asarPath] = fs.openSync(logPath, 'a')
  225. console.log('Logging ' + asarPath + ' access to ' + logPath)
  226. }
  227. fs.writeSync(logFDs[asarPath], offset + ': ' + filePath + '\n')
  228. }
  229. const {lstatSync} = fs
  230. fs.lstatSync = function (p) {
  231. const [isAsar, asarPath, filePath] = splitPath(p)
  232. if (!isAsar) {
  233. return lstatSync(p)
  234. }
  235. const archive = getOrCreateArchive(asarPath)
  236. if (!archive) {
  237. invalidArchiveError(asarPath)
  238. }
  239. const stats = archive.stat(filePath)
  240. if (!stats) {
  241. notFoundError(asarPath, filePath)
  242. }
  243. return asarStatsToFsStats(stats)
  244. }
  245. const {lstat} = fs
  246. fs.lstat = function (p, callback) {
  247. const [isAsar, asarPath, filePath] = splitPath(p)
  248. if (!isAsar) {
  249. return lstat(p, callback)
  250. }
  251. const archive = getOrCreateArchive(asarPath)
  252. if (!archive) {
  253. return invalidArchiveError(asarPath, callback)
  254. }
  255. const stats = getOrCreateArchive(asarPath).stat(filePath)
  256. if (!stats) {
  257. return notFoundError(asarPath, filePath, callback)
  258. }
  259. process.nextTick(function () {
  260. callback(null, asarStatsToFsStats(stats))
  261. })
  262. }
  263. const {statSync} = fs
  264. fs.statSync = function (p) {
  265. const [isAsar] = splitPath(p)
  266. if (!isAsar) {
  267. return statSync(p)
  268. }
  269. // Do not distinguish links for now.
  270. return fs.lstatSync(p)
  271. }
  272. const {stat} = fs
  273. fs.stat = function (p, callback) {
  274. const [isAsar] = splitPath(p)
  275. if (!isAsar) {
  276. return stat(p, callback)
  277. }
  278. // Do not distinguish links for now.
  279. process.nextTick(function () {
  280. fs.lstat(p, callback)
  281. })
  282. }
  283. const {statSyncNoException} = fs
  284. fs.statSyncNoException = function (p) {
  285. const [isAsar, asarPath, filePath] = splitPath(p)
  286. if (!isAsar) {
  287. return statSyncNoException(p)
  288. }
  289. const archive = getOrCreateArchive(asarPath)
  290. if (!archive) {
  291. return false
  292. }
  293. const stats = archive.stat(filePath)
  294. if (!stats) {
  295. return false
  296. }
  297. return asarStatsToFsStats(stats)
  298. }
  299. const {realpathSync} = fs
  300. fs.realpathSync = function (p) {
  301. const [isAsar, asarPath, filePath] = splitPath(p)
  302. if (!isAsar) {
  303. return realpathSync.apply(this, arguments)
  304. }
  305. const archive = getOrCreateArchive(asarPath)
  306. if (!archive) {
  307. invalidArchiveError(asarPath)
  308. }
  309. const real = archive.realpath(filePath)
  310. if (real === false) {
  311. notFoundError(asarPath, filePath)
  312. }
  313. return path.join(realpathSync(asarPath), real)
  314. }
  315. const {realpath} = fs
  316. fs.realpath = function (p, cache, callback) {
  317. const [isAsar, asarPath, filePath] = splitPath(p)
  318. if (!isAsar) {
  319. return realpath.apply(this, arguments)
  320. }
  321. if (typeof cache === 'function') {
  322. callback = cache
  323. cache = void 0
  324. }
  325. const archive = getOrCreateArchive(asarPath)
  326. if (!archive) {
  327. return invalidArchiveError(asarPath, callback)
  328. }
  329. const real = archive.realpath(filePath)
  330. if (real === false) {
  331. return notFoundError(asarPath, filePath, callback)
  332. }
  333. return realpath(asarPath, function (err, p) {
  334. if (err) {
  335. return callback(err)
  336. }
  337. return callback(null, path.join(p, real))
  338. })
  339. }
  340. const {exists} = fs
  341. fs.exists = function (p, callback) {
  342. const [isAsar, asarPath, filePath] = splitPath(p)
  343. if (!isAsar) {
  344. return exists(p, callback)
  345. }
  346. const archive = getOrCreateArchive(asarPath)
  347. if (!archive) {
  348. return invalidArchiveError(asarPath, callback)
  349. }
  350. process.nextTick(function () {
  351. // Disabled due to false positive in StandardJS
  352. // eslint-disable-next-line standard/no-callback-literal
  353. callback(archive.stat(filePath) !== false)
  354. })
  355. }
  356. fs.exists[util.promisify.custom] = function (p) {
  357. const [isAsar, asarPath, filePath] = splitPath(p)
  358. if (!isAsar) {
  359. return exists[util.promisify.custom](p)
  360. }
  361. const archive = getOrCreateArchive(asarPath)
  362. if (!archive) {
  363. return new Promise(() => invalidArchiveError(asarPath))
  364. }
  365. return Promise.resolve(archive.stat(filePath) !== false)
  366. }
  367. const {existsSync} = fs
  368. fs.existsSync = function (p) {
  369. const [isAsar, asarPath, filePath] = splitPath(p)
  370. if (!isAsar) {
  371. return existsSync(p)
  372. }
  373. const archive = getOrCreateArchive(asarPath)
  374. if (!archive) {
  375. return false
  376. }
  377. return archive.stat(filePath) !== false
  378. }
  379. const {access} = fs
  380. fs.access = function (p, mode, callback) {
  381. const [isAsar, asarPath, filePath] = splitPath(p)
  382. if (!isAsar) {
  383. return access.apply(this, arguments)
  384. }
  385. if (typeof mode === 'function') {
  386. callback = mode
  387. mode = fs.constants.F_OK
  388. }
  389. const archive = getOrCreateArchive(asarPath)
  390. if (!archive) {
  391. return invalidArchiveError(asarPath, callback)
  392. }
  393. const info = archive.getFileInfo(filePath)
  394. if (!info) {
  395. return notFoundError(asarPath, filePath, callback)
  396. }
  397. if (info.unpacked) {
  398. const realPath = archive.copyFileOut(filePath)
  399. return fs.access(realPath, mode, callback)
  400. }
  401. const stats = getOrCreateArchive(asarPath).stat(filePath)
  402. if (!stats) {
  403. return notFoundError(asarPath, filePath, callback)
  404. }
  405. if (mode & fs.constants.W_OK) {
  406. return accessError(asarPath, filePath, callback)
  407. }
  408. process.nextTick(function () {
  409. callback()
  410. })
  411. }
  412. const {accessSync} = fs
  413. fs.accessSync = function (p, mode) {
  414. const [isAsar, asarPath, filePath] = splitPath(p)
  415. if (!isAsar) {
  416. return accessSync.apply(this, arguments)
  417. }
  418. if (mode == null) {
  419. mode = fs.constants.F_OK
  420. }
  421. const archive = getOrCreateArchive(asarPath)
  422. if (!archive) {
  423. invalidArchiveError(asarPath)
  424. }
  425. const info = archive.getFileInfo(filePath)
  426. if (!info) {
  427. notFoundError(asarPath, filePath)
  428. }
  429. if (info.unpacked) {
  430. const realPath = archive.copyFileOut(filePath)
  431. return fs.accessSync(realPath, mode)
  432. }
  433. const stats = getOrCreateArchive(asarPath).stat(filePath)
  434. if (!stats) {
  435. notFoundError(asarPath, filePath)
  436. }
  437. if (mode & fs.constants.W_OK) {
  438. accessError(asarPath, filePath)
  439. }
  440. }
  441. const {readFile} = fs
  442. fs.readFile = function (p, options, callback) {
  443. const [isAsar, asarPath, filePath] = splitPath(p)
  444. if (!isAsar) {
  445. return readFile.apply(this, arguments)
  446. }
  447. if (typeof options === 'function') {
  448. callback = options
  449. options = {
  450. encoding: null
  451. }
  452. } else if (typeof options === 'string') {
  453. options = {
  454. encoding: options
  455. }
  456. } else if (options === null || options === undefined) {
  457. options = {
  458. encoding: null
  459. }
  460. } else if (typeof options !== 'object') {
  461. throw new TypeError('Bad arguments')
  462. }
  463. const {encoding} = options
  464. const archive = getOrCreateArchive(asarPath)
  465. if (!archive) {
  466. return invalidArchiveError(asarPath, callback)
  467. }
  468. const info = archive.getFileInfo(filePath)
  469. if (!info) {
  470. return notFoundError(asarPath, filePath, callback)
  471. }
  472. if (info.size === 0) {
  473. return process.nextTick(function () {
  474. callback(null, encoding ? '' : Buffer.alloc(0))
  475. })
  476. }
  477. if (info.unpacked) {
  478. const realPath = archive.copyFileOut(filePath)
  479. return fs.readFile(realPath, options, callback)
  480. }
  481. const buffer = Buffer.alloc(info.size)
  482. const fd = archive.getFd()
  483. if (!(fd >= 0)) {
  484. return notFoundError(asarPath, filePath, callback)
  485. }
  486. logASARAccess(asarPath, filePath, info.offset)
  487. fs.read(fd, buffer, 0, info.size, info.offset, function (error) {
  488. callback(error, encoding ? buffer.toString(encoding) : buffer)
  489. })
  490. }
  491. const {readFileSync} = fs
  492. fs.readFileSync = function (p, options) {
  493. const [isAsar, asarPath, filePath] = splitPath(p)
  494. if (!isAsar) {
  495. return readFileSync.apply(this, arguments)
  496. }
  497. const archive = getOrCreateArchive(asarPath)
  498. if (!archive) {
  499. invalidArchiveError(asarPath)
  500. }
  501. const info = archive.getFileInfo(filePath)
  502. if (!info) {
  503. notFoundError(asarPath, filePath)
  504. }
  505. if (info.size === 0) {
  506. if (options) {
  507. return ''
  508. } else {
  509. return Buffer.alloc(0)
  510. }
  511. }
  512. if (info.unpacked) {
  513. const realPath = archive.copyFileOut(filePath)
  514. return fs.readFileSync(realPath, options)
  515. }
  516. if (!options) {
  517. options = {
  518. encoding: null
  519. }
  520. } else if (typeof options === 'string') {
  521. options = {
  522. encoding: options
  523. }
  524. } else if (typeof options !== 'object') {
  525. throw new TypeError('Bad arguments')
  526. }
  527. const {encoding} = options
  528. const buffer = Buffer.alloc(info.size)
  529. const fd = archive.getFd()
  530. if (!(fd >= 0)) {
  531. notFoundError(asarPath, filePath)
  532. }
  533. logASARAccess(asarPath, filePath, info.offset)
  534. fs.readSync(fd, buffer, 0, info.size, info.offset)
  535. if (encoding) {
  536. return buffer.toString(encoding)
  537. } else {
  538. return buffer
  539. }
  540. }
  541. const {readdir} = fs
  542. fs.readdir = function (p, callback) {
  543. const [isAsar, asarPath, filePath] = splitPath(p)
  544. if (!isAsar) {
  545. return readdir.apply(this, arguments)
  546. }
  547. const archive = getOrCreateArchive(asarPath)
  548. if (!archive) {
  549. return invalidArchiveError(asarPath, callback)
  550. }
  551. const files = archive.readdir(filePath)
  552. if (!files) {
  553. return notFoundError(asarPath, filePath, callback)
  554. }
  555. process.nextTick(function () {
  556. callback(null, files)
  557. })
  558. }
  559. const {readdirSync} = fs
  560. fs.readdirSync = function (p) {
  561. const [isAsar, asarPath, filePath] = splitPath(p)
  562. if (!isAsar) {
  563. return readdirSync.apply(this, arguments)
  564. }
  565. const archive = getOrCreateArchive(asarPath)
  566. if (!archive) {
  567. invalidArchiveError(asarPath)
  568. }
  569. const files = archive.readdir(filePath)
  570. if (!files) {
  571. notFoundError(asarPath, filePath)
  572. }
  573. return files
  574. }
  575. const {internalModuleReadFile} = process.binding('fs')
  576. process.binding('fs').internalModuleReadFile = function (p) {
  577. const [isAsar, asarPath, filePath] = splitPath(p)
  578. if (!isAsar) {
  579. return internalModuleReadFile(p)
  580. }
  581. const archive = getOrCreateArchive(asarPath)
  582. if (!archive) {
  583. return
  584. }
  585. const info = archive.getFileInfo(filePath)
  586. if (!info) {
  587. return
  588. }
  589. if (info.size === 0) {
  590. return ''
  591. }
  592. if (info.unpacked) {
  593. const realPath = archive.copyFileOut(filePath)
  594. return fs.readFileSync(realPath, {
  595. encoding: 'utf8'
  596. })
  597. }
  598. const buffer = Buffer.alloc(info.size)
  599. const fd = archive.getFd()
  600. if (!(fd >= 0)) {
  601. return
  602. }
  603. logASARAccess(asarPath, filePath, info.offset)
  604. fs.readSync(fd, buffer, 0, info.size, info.offset)
  605. return buffer.toString('utf8')
  606. }
  607. const {internalModuleStat} = process.binding('fs')
  608. process.binding('fs').internalModuleStat = function (p) {
  609. const [isAsar, asarPath, filePath] = splitPath(p)
  610. if (!isAsar) {
  611. return internalModuleStat(p)
  612. }
  613. const archive = getOrCreateArchive(asarPath)
  614. // -ENOENT
  615. if (!archive) {
  616. return -34
  617. }
  618. const stats = archive.stat(filePath)
  619. // -ENOENT
  620. if (!stats) {
  621. return -34
  622. }
  623. if (stats.isDirectory) {
  624. return 1
  625. } else {
  626. return 0
  627. }
  628. }
  629. // Calling mkdir for directory inside asar archive should throw ENOTDIR
  630. // error, but on Windows it throws ENOENT.
  631. // This is to work around the recursive looping bug of mkdirp since it is
  632. // widely used.
  633. if (process.platform === 'win32') {
  634. const {mkdir} = fs
  635. fs.mkdir = function (p, mode, callback) {
  636. if (typeof mode === 'function') {
  637. callback = mode
  638. }
  639. const [isAsar, , filePath] = splitPath(p)
  640. if (isAsar && filePath.length) {
  641. return notDirError(callback)
  642. }
  643. mkdir(p, mode, callback)
  644. }
  645. const {mkdirSync} = fs
  646. fs.mkdirSync = function (p, mode) {
  647. const [isAsar, , filePath] = splitPath(p)
  648. if (isAsar && filePath.length) {
  649. notDirError()
  650. }
  651. return mkdirSync(p, mode)
  652. }
  653. }
  654. // Executing a command string containing a path to an asar
  655. // archive confuses `childProcess.execFile`, which is internally
  656. // called by `childProcess.{exec,execSync}`, causing
  657. // Electron to consider the full command as a single path
  658. // to an archive.
  659. const {exec, execSync} = childProcess
  660. childProcess.exec = invokeWithNoAsar(exec)
  661. childProcess.exec[util.promisify.custom] = invokeWithNoAsar(exec[util.promisify.custom])
  662. childProcess.execSync = invokeWithNoAsar(execSync)
  663. function invokeWithNoAsar (func) {
  664. return function () {
  665. const processNoAsarOriginalValue = process.noAsar
  666. process.noAsar = true
  667. try {
  668. return func.apply(this, arguments)
  669. } finally {
  670. process.noAsar = processNoAsarOriginalValue
  671. }
  672. }
  673. }
  674. overrideAPI(fs, 'open')
  675. overrideAPI(childProcess, 'execFile')
  676. overrideAPISync(process, 'dlopen', 1)
  677. overrideAPISync(require('module')._extensions, '.node', 1)
  678. overrideAPISync(fs, 'openSync')
  679. overrideAPISync(childProcess, 'execFileSync')
  680. }
  681. })()