fix stream

This commit is contained in:
Chris Wanstrath 2025-10-01 15:28:16 -07:00
parent 7037339cc4
commit ef761881ff

View File

@ -21,13 +21,13 @@ export async function stream(initOrFn: StreamParamFn | string | any, fn?: Stream
} }
const append = async (output: string | any) => { const append = async (output: string | any) => {
const [status, data] = processExecOutput(output) const { status, output: data } = processExecOutput(output)
if (status === "error") error = true if (status === "error") error = true
send({ type: "stream:append", data }) send({ type: "stream:append", data })
} }
const replace = async (output: string | any) => { const replace = async (output: string | any) => {
const [status, data] = processExecOutput(output) const { status, output: data } = processExecOutput(output)
if (status === "error") error = true if (status === "error") error = true
send({ type: "stream:replace", data }) send({ type: "stream:replace", data })
} }
@ -38,7 +38,7 @@ export async function stream(initOrFn: StreamParamFn | string | any, fn?: Stream
if (typeof initOrFn === "function") { if (typeof initOrFn === "function") {
func = initOrFn func = initOrFn
} else { } else {
init = processExecOutput(initOrFn)[1] init = processExecOutput(initOrFn).output
func = fn func = fn
} }