mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
test stdio closed
This commit is contained in:
@@ -29,7 +29,7 @@ export function getStdioWriteStream(fd) {
|
||||
|
||||
let stream;
|
||||
if (tty.isatty(fd)) {
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream = new tty.WriteStream(null, { fd });
|
||||
// TODO: this is the wrong place for this property.
|
||||
// but the TTY is technically duplex
|
||||
// see test-fs-syncwritestream.js
|
||||
@@ -40,7 +40,7 @@ export function getStdioWriteStream(fd) {
|
||||
stream._type = "tty";
|
||||
} else {
|
||||
const fs = require("node:fs");
|
||||
stream = new fs.WriteStream(fd, { autoClose: false, fd });
|
||||
stream = new fs.WriteStream(null, { autoClose: false, fd });
|
||||
stream.readable = false;
|
||||
stream._type = "fs";
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export function getStdinStream(fd) {
|
||||
|
||||
const tty = require("node:tty");
|
||||
const ReadStream = tty.isatty(fd) ? tty.ReadStream : require("node:fs").ReadStream;
|
||||
const stream = new ReadStream(fd);
|
||||
const stream = new ReadStream(null, { fd });
|
||||
|
||||
const originalOn = stream.on;
|
||||
|
||||
|
||||
@@ -10,10 +10,7 @@ function ReadStream(fd) {
|
||||
if (!(this instanceof ReadStream)) {
|
||||
return new ReadStream(fd);
|
||||
}
|
||||
if (fd >> 0 !== fd || fd < 0) throw new RangeError("fd must be a positive integer");
|
||||
|
||||
require("node:fs").ReadStream.$apply(this, ["", { fd }]);
|
||||
|
||||
this.isRaw = false;
|
||||
this.isTTY = true;
|
||||
}
|
||||
@@ -79,7 +76,6 @@ Object.defineProperty(ReadStream, "prototype", {
|
||||
|
||||
function WriteStream(fd) {
|
||||
if (!(this instanceof WriteStream)) return new WriteStream(fd);
|
||||
if (fd >> 0 !== fd || fd < 0) throw new RangeError("fd must be a positive integer");
|
||||
|
||||
const stream = require("node:fs").WriteStream.$call(this, "", { fd });
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ if (common.isWindows) {
|
||||
proc.on('exit', common.mustCall(function(exitCode) {
|
||||
assert.strictEqual(exitCode, 0);
|
||||
}));
|
||||
proc.stderr.pipe(process.stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user