Files
bun.sh/test/js/bun/spawn/spawn-stdin-readable-stream-sync.test.ts
Jarred Sumner 1d48f91b5e Enable ReadableStream as stdin for Bun.spawn (#20582)
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: jarred <jarred@bun.sh>
Co-authored-by: pfg <pfg@pfg.pw>
2025-06-27 19:42:03 -07:00

24 lines
618 B
TypeScript

import { spawnSync } from "bun";
import { describe, expect, test } from "bun:test";
import { bunExe } from "harness";
describe("spawnSync with ReadableStream stdin", () => {
test("spawnSync should throw", () => {
const stream = new ReadableStream({
async start(controller) {
await 42;
controller.enqueue("test data");
controller.close();
},
});
expect(() =>
spawnSync({
cmd: [bunExe()],
stdin: stream,
stdout: "pipe",
}),
).toThrowErrorMatchingInlineSnapshot(`"'stdin' ReadableStream cannot be used in sync mode"`);
});
});