|
@@ -149,13 +149,20 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
|
|
|
return `Upgrade failed for ${method}.`
|
|
return `Upgrade failed for ${method}.`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const upgradeScriptShell = Effect.fnUntraced(function* () {
|
|
|
|
|
+ const bashVersion = yield* text(["bash", "--version"])
|
|
|
|
|
+ if (bashVersion) return "bash"
|
|
|
|
|
+ return "sh"
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
const upgradeCurl = Effect.fnUntraced(
|
|
const upgradeCurl = Effect.fnUntraced(
|
|
|
function* (target: string) {
|
|
function* (target: string) {
|
|
|
const response = yield* httpOk.execute(HttpClientRequest.get("https://opencode.ai/install"))
|
|
const response = yield* httpOk.execute(HttpClientRequest.get("https://opencode.ai/install"))
|
|
|
const body = yield* response.text
|
|
const body = yield* response.text
|
|
|
const bodyBytes = new TextEncoder().encode(body)
|
|
const bodyBytes = new TextEncoder().encode(body)
|
|
|
|
|
+ const shell = yield* upgradeScriptShell()
|
|
|
const result = yield* appProcess.run(
|
|
const result = yield* appProcess.run(
|
|
|
- ChildProcess.make("bash", [], {
|
|
|
|
|
|
|
+ ChildProcess.make(shell, [], {
|
|
|
stdin: Stream.make(bodyBytes),
|
|
stdin: Stream.make(bodyBytes),
|
|
|
env: { VERSION: target },
|
|
env: { VERSION: target },
|
|
|
extendEnv: true,
|
|
extendEnv: true,
|