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>
This commit is contained in:
YeonGyu-Kim
2026-05-22 20:40:24 +09:00
parent d17b2127f2
commit aded57ff1f
8 changed files with 42 additions and 20 deletions
@@ -1,6 +1,7 @@
import { spawn } from "../bun-spawn-shim"
import type { ArchiveEntry } from "../archive-entry-validator"
import { readProcessStream } from "../process-stream-reader"
export type PowerShellZipExtractor = "pwsh" | "powershell"
@@ -82,8 +83,9 @@ export async function listZipEntriesWithPowerShell(
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {
@@ -1,6 +1,7 @@
import { spawn, spawnSync } from "../bun-spawn-shim"
import type { ArchiveEntry } from "../archive-entry-validator"
import { readProcessStream } from "../process-stream-reader"
export function isPythonZipListingAvailable(): boolean {
const proc = spawnSync(["python3", "--version"], {
@@ -43,8 +44,9 @@ export async function listZipEntriesWithPython(
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {
@@ -1,4 +1,5 @@
import { spawn } from "../bun-spawn-shim"
import { readProcessStream } from "../process-stream-reader"
export async function readZipSymlinkTarget(
archivePath: string,
@@ -11,8 +12,9 @@ export async function readZipSymlinkTarget(
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {
@@ -2,6 +2,7 @@ import { spawn } from "../bun-spawn-shim"
import type { ArchiveEntry } from "../archive-entry-validator"
import { log } from "../logger"
import { readProcessStream } from "../process-stream-reader"
@@ -81,8 +82,9 @@ export async function listZipEntriesWithTar(
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {
@@ -1,6 +1,7 @@
import { spawn, spawnSync } from "../bun-spawn-shim"
import type { ArchiveEntry } from "../archive-entry-validator"
import { readProcessStream } from "../process-stream-reader"
import { readZipSymlinkTarget } from "./read-zip-symlink-target"
export function parseZipInfoListedEntry(line: string): ArchiveEntry | null {
@@ -45,8 +46,9 @@ export async function listZipEntriesWithZipInfo(
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
// #3919: Use Buffer-concat stream reads for Node utility-process compatibility.
readProcessStream(proc.stdout),
readProcessStream(proc.stderr),
])
if (exitCode !== 0) {