@@ -10,7 +10,7 @@ import kernelSourceFunc from './bundles/kernel';
10
10
import buildKernelNonSES from './kernel/index' ;
11
11
import bundleSource from './build-source-bundle' ;
12
12
13
- export function loadBasedir ( basedir , state ) {
13
+ export function loadBasedir ( basedir , stateArg ) {
14
14
console . log ( `= loading config from basedir ${ basedir } ` ) ;
15
15
const vatSources = new Map ( ) ;
16
16
const subs = fs . readdirSync ( basedir , { withFileTypes : true } ) ;
@@ -37,6 +37,14 @@ export function loadBasedir(basedir, state) {
37
37
} catch ( e ) {
38
38
bootstrapIndexJS = undefined ;
39
39
}
40
+ let state ;
41
+ const stateFile = path . resolve ( basedir , 'state.json' ) ;
42
+ try {
43
+ const stateData = fs . readFileSync ( stateFile ) ;
44
+ state = JSON . parse ( stateData ) ;
45
+ } catch ( e ) {
46
+ state = stateArg ;
47
+ }
40
48
return harden ( { vatSources, bootstrapIndexJS, state } ) ;
41
49
}
42
50
@@ -160,9 +168,11 @@ export async function buildVatController(config, withSES = true, argv = []) {
160
168
161
169
if ( config . state ) {
162
170
await kernel . loadState ( config . state ) ;
171
+ console . log ( `loadState complete` ) ;
163
172
} else if ( config . bootstrapIndexJS ) {
164
173
// we invoke obj[0].bootstrap with an object that contains 'vats' and
165
174
// 'argv'.
175
+ console . log ( `queueing bootstrap()` ) ;
166
176
kernel . callBootstrap ( '_bootstrap' , JSON . stringify ( argv ) ) ;
167
177
}
168
178
0 commit comments