Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

printf stops working after command completion #54

Open
guybedford opened this issue Jan 9, 2023 · 3 comments
Open

printf stops working after command completion #54

guybedford opened this issue Jan 9, 2023 · 3 comments

Comments

@guybedford
Copy link

I've got a component which executes as a command via main(), after which exported functions may be called as part of an extended lifecycle for the application.

I'm finding that while these executions work correctly, and wasi-logging works correctly, printf only works correctly during the main() function, and after that its output is being entirely swallowed.

Here's a repo demonstrating the case - https://github.com/guybedford/wasi-command-export-printf. It's still a largeish component for Spidermonkey, I could possibly reduce it further, but perhaps the above is enough to track.

@sunfishcode
Copy link
Member

I've looked through the code in wasi-libc and the polyfill and I've not found an obvious reason why stdout should stop working.

What version of wasm-tools are you using? Running the script in that repo fails with:

Error: decoding custom section component-type:wasi

Caused by:
    unsupported component version: 0xa (at offset 0x0)

@guybedford
Copy link
Author

It should build against the version of wasm-tools from the main branch currently. If that's still not working I can try and come up with a simpler replication.

@guybedford
Copy link
Author

An extension of this is that printf isn't working when not running a command as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants