mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-17 18:12:42 +00:00
effect(core): track stderr truncation; polish AppProcess callers (#27353)
This commit is contained in:
@@ -5,6 +5,7 @@ import { InstanceState } from "@/effect/instance-state"
|
||||
import path from "path"
|
||||
import { mergeDeep } from "remeda"
|
||||
import { Config } from "@/config/config"
|
||||
import { errorMessage } from "@/util/error"
|
||||
import * as Log from "@opencode-ai/core/util/log"
|
||||
import * as Formatter from "./formatter"
|
||||
|
||||
@@ -100,7 +101,7 @@ export const layer = Layer.effect(
|
||||
command: cmd,
|
||||
...item.environment,
|
||||
file: filepath,
|
||||
cause: error.message,
|
||||
cause: errorMessage(error.cause ?? error),
|
||||
})
|
||||
return undefined
|
||||
}),
|
||||
|
||||
@@ -124,7 +124,7 @@ export const layer = Layer.effect(
|
||||
text: () => result.stdout.toString("utf8"),
|
||||
stdout: result.stdout,
|
||||
stderr: result.stderr,
|
||||
truncated: result.truncated,
|
||||
truncated: result.stdoutTruncated || result.stderrTruncated,
|
||||
} satisfies Result
|
||||
},
|
||||
Effect.catch((err) => Effect.succeed(fail(err))),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Effect, Layer, Schema, Context, Stream } from "effect"
|
||||
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http"
|
||||
import { withTransientReadRetry } from "@/util/effect-http-client"
|
||||
import { errorMessage } from "@/util/error"
|
||||
import { ChildProcess } from "effect/unstable/process"
|
||||
import { AppProcess } from "@opencode-ai/core/process"
|
||||
import path from "path"
|
||||
@@ -124,7 +125,7 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
|
||||
stderr: result.stderr.toString("utf8"),
|
||||
}
|
||||
},
|
||||
Effect.catch(() => Effect.succeed({ code: 1, stdout: "", stderr: "" })),
|
||||
Effect.catch((err) => Effect.succeed({ code: 1, stdout: "", stderr: errorMessage(err) })),
|
||||
)
|
||||
|
||||
const getBrewFormula = Effect.fnUntraced(function* () {
|
||||
|
||||
Reference in New Issue
Block a user