logging: avoids logging activity to stdio file descriptors (#1007)

This avoids logging activity on stdio file descriptors, in order to help
make troubleshooting easier. Usually, there isn't an issue in these, yet
wasm panics are harder to read if there is also logging of the ..
logging.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-01-04 16:04:40 +08:00
committed by GitHub
parent 3ab7e4b36d
commit f8a33cef8d
11 changed files with 73 additions and 80 deletions

View File

@@ -251,3 +251,14 @@ func (f *stackFunc) Call(ctx context.Context, mod api.Module, wasmStack []uint64
func NewStack(name string, mem api.Memory, sp uint32) *stack {
return &stack{goarch.NewStack(name, mem, sp)}
}
var Undefined = struct{ name string }{name: "undefined"}
func ValueToUint32(arg interface{}) uint32 {
if arg == RefValueZero || arg == Undefined {
return 0
} else if u, ok := arg.(uint32); ok {
return u
}
return uint32(arg.(float64))
}