How to start job and wait for stdout synchronously

I need to start job and wait synchronously for some stdout output, which will indicate, that job (rpc service) is ready to use.
I can pass on_stdout callback, but it is async, that is not satisfies my requirements.
Is it possible at all to do this?

You can use jobwait() to synchronously wait for a background job started with jobstart().

But you might also just want to run system() instead of jobstart().

I don’t think there’s a way to do something like “block until a certain output is received, and then proceed asynchronously.”

I see plugins handle this situation by emitting a message that the user must wait for the remote plugin to start, and then emitting another message to inform the user that it’s ready.