I use SystemRunner::block_on() in my main function to run my http server. It is ergonomic since it passes through my std::process::ExitCode return value from my future. Now I would like to use System::current().stop() to shutdown my server. Unfortunately, I don't see a way to await the stop event within my block_on future.
I considered multiple workarounds, and am currently constructing an extra Oneshot channel and passing it around my application (losing the benefit of System::current().stop() working anywhere).
I use
SystemRunner::block_on()
in mymain
function to run my http server. It is ergonomic since it passes through mystd::process::ExitCode
return value from my future. Now I would like to useSystem::current().stop()
to shutdown my server. Unfortunately, I don't see a way toawait
the stop event within myblock_on
future.One possible design:
I considered multiple workarounds, and am currently constructing an extra
Oneshot
channel and passing it around my application (losing the benefit ofSystem::current().stop()
working anywhere).