aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/child-process-stdio.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/child-process-stdio.test.js')
-rw-r--r--test/bun.js/child-process-stdio.test.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/bun.js/child-process-stdio.test.js b/test/bun.js/child-process-stdio.test.js
index a023a6e03..5e295b2ca 100644
--- a/test/bun.js/child-process-stdio.test.js
+++ b/test/bun.js/child-process-stdio.test.js
@@ -1,12 +1,13 @@
import { describe, it, expect, beforeAll } from "bun:test";
import { spawn, execSync } from "node:child_process";
+import { bunExe } from "bunExe";
const CHILD_PROCESS_FILE = import.meta.dir + "/spawned-child.js";
const OUT_FILE = import.meta.dir + "/stdio-test-out.txt";
describe("process.stdout", () => {
it("should allow us to write to it", (done) => {
- const child = spawn("bun", [CHILD_PROCESS_FILE, "STDOUT"]);
+ const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDOUT"]);
child.stdout.setEncoding("utf8");
child.stdout.on("data", (data) => {
try {
@@ -23,7 +24,7 @@ describe("process.stdin", () => {
it("should allow us to read from stdin in readable mode", (done) => {
const input = "hello\n";
// Child should read from stdin and write it back
- const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "READABLE"]);
+ const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "READABLE"]);
let data = "";
child.stdout.setEncoding("utf8");
child.stdout.on("data", (chunk) => {
@@ -43,7 +44,7 @@ describe("process.stdin", () => {
it("should allow us to read from stdin via flowing mode", (done) => {
const input = "hello\n";
// Child should read from stdin and write it back
- const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]);
+ const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]);
let data = "";
child.stdout.setEncoding("utf8");
child.stdout.on("readable", () => {
@@ -67,7 +68,7 @@ describe("process.stdin", () => {
const numReps = Math.ceil((66 * 1024) / 5);
const input = "hello".repeat(numReps);
// Child should read from stdin and write it back
- const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]);
+ const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]);
let data = "";
child.stdout.setEncoding("utf8");
child.stdout.on("readable", () => {
@@ -89,7 +90,7 @@ describe("process.stdin", () => {
it("should allow us to read from a file", () => {
const result = execSync(
- `bun ${CHILD_PROCESS_FILE} STDIN FLOWING < ${
+ `${bunExe()} ${CHILD_PROCESS_FILE} STDIN FLOWING < ${
import.meta.dir
}/readFileSync.txt`,
{ encoding: "utf8" },