MCPcopy Index your code
hub / github.com/anomalyco/opencode / withShell

Function withShell

packages/opencode/test/tool/shell.test.ts:136–153  ·  view source on GitHub ↗
(item: { label: string; shell: string }, self: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

134}
135
136const withShell = <A, E, R>(item: { label: string; shell: string }, self: Effect.Effect<A, E, R>) =>
137 Effect.acquireUseRelease(
138 Effect.sync(() => {
139 const prev = process.env.SHELL
140 process.env.SHELL = item.shell
141 Shell.acceptable.reset()
142 Shell.preferred.reset()
143 return prev
144 }),
145 () => self,
146 (prev) =>
147 Effect.sync(() => {
148 if (prev === undefined) delete process.env.SHELL
149 else process.env.SHELL = prev
150 Shell.acceptable.reset()
151 Shell.preferred.reset()
152 }),
153 )
154
155const each = (
156 name: string,

Callers 2

eachFunction · 0.70
shell.test.tsFile · 0.70

Calls 2

syncMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected