Skip to content

Commit 56f0136

Browse files
Call initialize in RubyVM._instantiate
To initialize the VM state, we have to call it before any other operation.
1 parent 507ac47 commit 56f0136

File tree

1 file changed

+4
-1
lines changed
  • packages/npm-packages/ruby-wasm-wasi/src

1 file changed

+4
-1
lines changed

packages/npm-packages/ruby-wasm-wasi/src/vm.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export class RubyVM {
8484
this.exceptionFormatter = new RbExceptionFormatter();
8585
}
8686

87-
static async _instantiate(initComponent: (_: typeof RubyJsJsRuntime) => Promise<typeof RubyJsRubyRuntime>): Promise<RubyVM> {
87+
static async _instantiate(initComponent: (_: typeof RubyJsJsRuntime) => Promise<typeof RubyJsRubyRuntime>, options: {
88+
args?: string[],
89+
}): Promise<RubyVM> {
8890
const binding = new ComponentBinding()
8991
const vm = new RubyVM(binding);
9092
const component = await initComponent({
@@ -95,6 +97,7 @@ export class RubyVM {
9597
JsAbiValue: Object,
9698
});
9799
binding.setUnderlying(component);
100+
vm.initialize(options.args);
98101
return vm
99102
}
100103

0 commit comments

Comments
 (0)