def PipeSession.ask.within

bend-pipe-session@0.2.0.0 · impl.bend:187

import bend-pipe-session@0.2.0.0/impl.bend as Impl
import Base

187# As PipeSession.ask, within ms; None when the program has not answered by then: it is killed, and
188# the session is gone. Nothing of it runs on after.
189def PipeSession.ask.within(
190  session: PipeSession,
191  lines: List<String>,
192  +until: String,
193  ms: U32
194) -> IO(Maybe<PipeSession.Answer()>):
195  match session:
196    case PipeSession{+pid, input, out, line_cap}:
197      do IO<Maybe<PipeSession.Answer()>>:
198        +chan: Chan(PipeSession.Answer()) <- Chan.new(PipeSession.Answer(), 1)
199        forked: Chan(
200          PipeSession.Answer()
201        ) <- IO.fork.go(
202          PipeSession.Answer(),
203          PipeSession.ask(PipeSession{pid, input, out, line_cap}, lines, until),
204          chan
205        )
206        polled: Poll<&1, &1, Maybe<&1, PipeSession.Answer()>, Unit> <-
207          Chan.try_recv(PipeSession.Answer(), chan, ms)
208        PipeSession.ask.polled(pid, chan, polled)

Uses (16)

Used by (0)

No other definition uses this definition.