-
Notifications
You must be signed in to change notification settings - Fork 18
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
Null strings are always read from STDIN #95
Comments
As @peterhuene commented here, this line could be the root cause of this issue. |
But this line doesn't exist any more. |
Current version is 0.4.3. |
Reading from stdin is still broken, but now it fails with a different error. I've rebuilt the example pasted above using:
The program now fails with the following message: $ echo hi | wasmtime run echo.wasm
type something
abort: in ~lib/rt/pure.ts(112:14)
Error: failed to run main module `echo.wasm`
Caused by:
0: failed to invoke command default
1: exit with invalid exit status outside of [0..126)
wasm backtrace:
0: 0x555 - <unknown>!<wasm function 9>
1: 0x1f6 - <unknown>!<wasm function 3>
2: 0x209 - <unknown>!<wasm function 4>
3: 0x2490 - <unknown>!<wasm function 54>
4: 0x2584 - <unknown>!<wasm function 57>
5: 0x25d8 - <unknown>!<wasm function 58>
|
Could you share your code? Do you use any interop between wasmtime host and wasm? |
It looks like something is calling |
It's the same code shown in the body of the issue. If you want I can create a gist |
@jedisct1 sorry to bother you, do you want me to open a new issue to track the |
Looks like a different issue. |
I've written a simple "echo" program using AssemblyScript and as-wasi. The program reads the user input from STDIN and writes it back to STDOUT.
Unfortunately it looks like I can never get back the input I enter.
This the source code of the AssemblyScript program I'm running:
The program can be compiled to a WASM binary by doing:
And it can be run in this way:
The program will start and I'll be able to enter my text. The program will keep reading from STDIN until I send the
EOF
symbol (I'm on Linux ->CTRL-D
).Unfortunately the
input
variable is alwaysnull
.if so, with which assertion?
I would expect the WASM program to be able to read data from stdin. The
input
object should hold the text I entered on my terminal.This is my stack:
as-wasi
: 0.4.0(Rust version, operating system, architecture...)
I'm running on a x86_64 Linux box that has openSUSE Tumbleweed
More information...
The
as-wasi
handles STDIN/STDOUT/STDERR by using instances of the Descriptor class. The library simply opens the file descriptor0
for STDIN,1
for STDOUT and2
for STDERR. In my tests it looks like opening the file descriptor0
always returns anull
instance ofDescriptor
; this doesn't happen with STDOUT and STDERR.The same issue happens also when running the program through a custom made Go program I wrote leveraging
wasmtime-go
.In that case I even tried to start the WASM binary not by inheriting the parent STDIN, but instead by using a text file I previously created. Also in this case the WASM binary got a
null
object when reading from the STDIN.Relevant: a similar WASM binary, generated by translating Rust -> WASM, just works as expected.
The text was updated successfully, but these errors were encountered: