Browse Source

wasi: do not crash if argc is 0

Instead, leave args at its default value (which provides a fake argv[0] as it has for a long time).

linux and mac do not seem affected.

Fixes #1862 (tinygo apps after v0.17.0-113-g7b761fa crash if run without argv[0])
pull/1844/head
Dan Kegel 4 years ago
committed by Ron Evans
parent
commit
8dfefb46d1
  1. 3
      src/runtime/runtime_wasm_wasi.go

3
src/runtime/runtime_wasm_wasi.go

@ -30,6 +30,9 @@ func init() {
// these args (argv).
var argc, argv_buf_size uint32
args_sizes_get(&argc, &argv_buf_size)
if argc == 0 {
return
}
// Obtain the command line arguments
argsSlice := make([]unsafe.Pointer, argc)

Loading…
Cancel
Save