Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename error message error? #389

Open
orangeC23 opened this issue Apr 12, 2023 · 0 comments
Open

Rename error message error? #389

orangeC23 opened this issue Apr 12, 2023 · 0 comments
Labels
❓ question Further information is requested

Comments

@orangeC23
Copy link

Summary

The wasm file is :
tmp-wasm.txt

The go file is :

package main

import (
	"fmt"
	wasmer "github.com/wasmerio/wasmer-go/wasmer"
	"io/ioutil"
)

func main() {

	// os.Chdir(filepath.Dir(os.Args[0]))

    wasmBytes, _ := ioutil.ReadFile("./tmp.wasm")

    store := wasmer.NewStore(wasmer.NewEngine())

	module, _ := wasmer.NewModule(store, wasmBytes)

    wasiEnv, _ := wasmer.NewWasiStateBuilder("test").
		Argument("--dir=.").
		// Environment("ABC", "DEF").
		//MapDirectory("./dir", "./dir").
		Finalize()
	if store == nil {
		fmt.Println("store is null")
	}
	if module == nil {
		fmt.Println("module is null")
	}
	importObject, err := wasiEnv.GenerateImportObject(store, module)
	check(err)

	instance, err := wasmer.NewInstance(module, importObject)
	check(err)

	start, err := instance.Exports.GetWasiStartFunction()
	check(err)
	start()

}

func check(e error) {
	if e != nil {
		panic(e)
	}
}

Additional details

The wasm file is to test whether renaming a nonexistent file could print correct error message.

Expected behavior

Print:

ENOENT: 44
EINVAL: 28
r: -1
errno: 44
rename() error: No such file or directory

Using wasmer with the command wasmer run --dir=. tmp.wasm it print the showed message.

Actual behavior

Print:

ENOENT: 44
EINVAL: 28
r: -1
errno: 76
rename() error: Capabilities insufficient

Am I using the wasmer-go api with mistake?

@orangeC23 orangeC23 added the ❓ question Further information is requested label Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant