Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wasmerio/go-ext-wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Feb 6, 2021
2 parents f646a2b + 900a42a commit ee74e01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions wasmer/wasi.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ func NewWasiStateBuilder(programName string) *WasiStateBuilder {
return stateBuilder
}

func (self *WasiStateBuilder) argument(argument string) *WasiStateBuilder {
func (self *WasiStateBuilder) Argument(argument string) *WasiStateBuilder {
cArgument := C.CString(argument)
defer C.free(unsafe.Pointer(cArgument))
C.wasi_config_arg(self.inner(), cArgument)

return self
}

func (self *WasiStateBuilder) environment(key string, value string) *WasiStateBuilder {
func (self *WasiStateBuilder) Environment(key string, value string) *WasiStateBuilder {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

Expand All @@ -122,7 +122,7 @@ func (self *WasiStateBuilder) environment(key string, value string) *WasiStateBu
return self
}

func (self *WasiStateBuilder) preopenDirectory(preopenDirectory string) *WasiStateBuilder {
func (self *WasiStateBuilder) PreopenDirectory(preopenDirectory string) *WasiStateBuilder {
cPreopenDirectory := C.CString(preopenDirectory)
defer C.free(unsafe.Pointer(cPreopenDirectory))

Expand All @@ -131,7 +131,7 @@ func (self *WasiStateBuilder) preopenDirectory(preopenDirectory string) *WasiSta
return self
}

func (self *WasiStateBuilder) mapDirectory(alias string, directory string) *WasiStateBuilder {
func (self *WasiStateBuilder) MapDirectory(alias string, directory string) *WasiStateBuilder {
cAlias := C.CString(alias)
defer C.free(unsafe.Pointer(cAlias))

Expand All @@ -143,37 +143,37 @@ func (self *WasiStateBuilder) mapDirectory(alias string, directory string) *Wasi
return self
}

func (self *WasiStateBuilder) inheritStdin() *WasiStateBuilder {
func (self *WasiStateBuilder) InheritStdin() *WasiStateBuilder {
C.wasi_config_inherit_stdin(self.inner())

return self
}

func (self *WasiStateBuilder) captureStdout() *WasiStateBuilder {
func (self *WasiStateBuilder) CaptureStdout() *WasiStateBuilder {
C.wasi_config_capture_stdout(self.inner())

return self
}

func (self *WasiStateBuilder) inheritStdout() *WasiStateBuilder {
func (self *WasiStateBuilder) InheritStdout() *WasiStateBuilder {
C.wasi_config_inherit_stdout(self.inner())

return self
}

func (self *WasiStateBuilder) captureStderr() *WasiStateBuilder {
func (self *WasiStateBuilder) CaptureStderr() *WasiStateBuilder {
C.wasi_config_capture_stderr(self.inner())

return self
}

func (self *WasiStateBuilder) inheritStderr() *WasiStateBuilder {
func (self *WasiStateBuilder) InheritStderr() *WasiStateBuilder {
C.wasi_config_inherit_stderr(self.inner())

return self
}

func (self *WasiStateBuilder) finalize() (*WasiEnvironment, error) {
func (self *WasiStateBuilder) Finalize() (*WasiEnvironment, error) {
return newWasiEnvironment(self)
}

Expand Down
12 changes: 6 additions & 6 deletions wasmer/wasi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func TestWasiWithCapturedStdout(t *testing.T) {
assert.NoError(t, err)

wasiEnv, err := NewWasiStateBuilder("test-program").
argument("--foo").
environment("ABC", "DEF").
environment("X", "ZY").
mapDirectory("the_host_current_directory", ".").
captureStdout().
finalize()
Argument("--foo").
Environment("ABC", "DEF").
Environment("X", "ZY").
MapDirectory("the_host_current_directory", ".").
CaptureStdout().
Finalize()
assert.NoError(t, err)

importObject, err := wasiEnv.GenerateImportObject(store, module)
Expand Down

0 comments on commit ee74e01

Please sign in to comment.