Fix Process.state deadlock, add a test

`Process.state` could never emit anything, because the ref was never set with the initial state value `s0`. (And the only other way to write to the ref was by consuming the stream first.)