Lock.held.run: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/lock.bend as Lock Lines 97-104 of cswap-bend-cli@0.1.0.0/lock.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/lock.bend&start_line=97&end_line=104 import Base import cswap-bend-cli@0.1.0.0/fs.bend as Fs def held.run(-A: Type, act: IO(Fs.Res(A)), m: Fs.Res(Maybe<&1, File>)) -> IO(Fs.Res(A)): match m: case Fail{e}: IO.pure(Fs.Res(A), Fail{e}) case Done{None{}}: IO.pure(Fs.Res(A), Fail{(11, "Failed to acquire lock - another instance may be running")}) case Done{Some{f}}: IO.bind(Fs.Res(A), Fs.Res(A), act, r => done.close(A, r, f)) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=File https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fs.bend&name=Res https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/lock.bend&name=done.close