@@ -3,7 +3,6 @@ const fs = require('fs')
3
3
const path = require ( 'path' )
4
4
const electronLink = require ( 'electron-link' )
5
5
const CONFIG = require ( '../config' )
6
- const vm = require ( 'vm' )
7
6
8
7
module . exports = function ( packagedAppPath ) {
9
8
const snapshotScriptPath = path . join ( CONFIG . buildOutputPath , 'startup.js' )
@@ -76,7 +75,20 @@ module.exports = function (packagedAppPath) {
76
75
process . stdout . write ( '\n' )
77
76
78
77
console . log ( 'Verifying if snapshot can be executed via `mksnapshot`' )
79
- vm . runInNewContext ( snapshotScript , undefined , { filename : snapshotScriptPath , displayErrors : true } )
78
+ const verifySnapshotScriptPath = path . join ( CONFIG . repositoryRootPath , 'script' , 'verify-snapshot-script' )
79
+ let nodeBundledInElectronPath
80
+ if ( process . platform === 'darwin' ) {
81
+ nodeBundledInElectronPath = path . join ( packagedAppPath , 'Contents' , 'MacOS' , 'Atom' )
82
+ } else if ( process . platform === 'win32' ) {
83
+ nodeBundledInElectronPath = path . join ( packagedAppPath , 'atom.exe' )
84
+ } else {
85
+ nodeBundledInElectronPath = path . join ( packagedAppPath , 'atom' )
86
+ }
87
+ childProcess . execFileSync (
88
+ nodeBundledInElectronPath ,
89
+ [ verifySnapshotScriptPath , snapshotScriptPath ] ,
90
+ { env : Object . assign ( { } , process . env , { ELECTRON_RUN_AS_NODE : 1 } ) }
91
+ )
80
92
81
93
const generatedStartupBlobPath = path . join ( CONFIG . buildOutputPath , 'snapshot_blob.bin' )
82
94
console . log ( `Generating startup blob at "${ generatedStartupBlobPath } "` )
0 commit comments