fermyon / spin-test

A utility for testing Spin applications
Apache License 2.0
17 stars 5 forks source link

Router can't write to stdout after wasi-fs changes #68

Closed itowlson closed 4 months ago

itowlson commented 4 months ago

I tried adding a println! to the router to diagnose a problem, but the output was never printed.

When I reverted to a version without the wasi-fs (#62) changes, the output was printed, so I'm guessing this is a hiccup from all the virtualisation changes. It's not critical but it did make debugging router errors that bit trickier grin

rylev commented 4 months ago

The router is now being built with the wasm32-unknown-unknown target which now turns the println! into a noop. The reason I did this was to more easily control what imports the router requires as the wasm32-wasi target pulls in a few imports even if no std lib functions are used.

The solution here is to use the bespoke println! macro which directly uses the get_stdout import which we defined in the spin-test-virt project. I'm not sure if we'll be able to move that out to a shared dependency or if we'll simply need to redefine that in the router project.