I was using https://github.com/esp-rs/esp-idf-template with devcontainers enabled to try wokwi. It turns out the devcontainer (helpfully!) tries to listen on port 9012 and redirect it. The sideffect from this though is that if trying to run wowki-server on the host rather than the VM, I get a "Address already in use".
Unforunately it seems that he current task code returns Ok(Err(_)) in case of await errors and NOT the expected Err(_) so the program would just silently stop for me which was annoying to debug. Note that task is of type Option<Result<Result<(), Error>, JoinError>> (!). So we need to treat both JoinError AND the underlying result/error.
I made the following changes:
also consider Ok(Err(...)) a potential return.
Added a context to the listen error code:telling me what it listens on is more useful than just saying "address in use, code 98".
After the change, I get:
❯ cargo run -- --chip esp32c3 ../../rust_development/c3/hello-world/target/riscv32imc-esp-espidf/debug/hello-world
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/wokwi-server --chip esp32c3 ../../rust_development/c3/hello-world/target/riscv32imc-esp-espidf/debug/hello-world`
Task failed: Failed to listen on 127.0.0.1:9012
Caused by:
Address already in use (os error 98)
I was using https://github.com/esp-rs/esp-idf-template with devcontainers enabled to try wokwi. It turns out the devcontainer (helpfully!) tries to listen on port 9012 and redirect it. The sideffect from this though is that if trying to run wowki-server on the host rather than the VM, I get a "Address already in use".
Unforunately it seems that he current task code returns
Ok(Err(_))
in case of await errors and NOT the expectedErr(_)
so the program would just silently stop for me which was annoying to debug. Note thattask
is of typeOption<Result<Result<(), Error>, JoinError>>
(!). So we need to treat both JoinError AND the underlying result/error.I made the following changes:
After the change, I get:
without it, it would just silently finish.