Files
oh-my-opencode/src/shared/zip-entry-listing/read-zip-symlink-target.ts
T
YeonGyu-Kim aded57ff1f fix(shared): harden ripgrep-cli, zip-extractor, binary-downloader subprocess paths
Same Web-Response-on-Node hazard existed in ripgrep auto-download flow,
zip extraction helpers, and binary downloader streams. Switch to the new
Node-safe reader and ensure no spawn path escapes as unhandledRejection.

Related to #3919.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-22 20:40:24 +09:00

26 lines
698 B
TypeScript

import { spawn } from "../bun-spawn-shim"
import { readProcessStream } from "../process-stream-reader"
export async function readZipSymlinkTarget(
archivePath: string,
entryPath: string
): Promise<string | undefined> {
const proc = spawn(["unzip", "-p", archivePath, "--", entryPath], {
stdout: "pipe",
stderr: "pipe",
})
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {
throw new Error(`zip symlink target read failed (exit ${exitCode}): ${stderr}`)
}
return stdout || undefined
}