aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/tty.js
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-09-28 03:53:24 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-28 03:53:24 -0700
commit387f1260c9dc0cea667b44ec0152fff0cd4def25 (patch)
tree24dde83cf812481b6d1c8de316a30ece7b745a54 /src/js/node/tty.js
parente60b3607c12c91959ec795228cc299703d5b09d0 (diff)
downloadbun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.gz
bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.zst
bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.zip
Get Next.js Pages Router to work (#6095)
* hell * make it so bun-debug-src * teag * wild * yippee * fas * fix async hooks assertions * yap * yeah that's wild * aa * a * increase time allowed * so trivial
Diffstat (limited to 'src/js/node/tty.js')
-rw-r--r--src/js/node/tty.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/js/node/tty.js b/src/js/node/tty.js
index 2ffc2d764..1c3fb2fac 100644
--- a/src/js/node/tty.js
+++ b/src/js/node/tty.js
@@ -11,30 +11,34 @@ function ReadStream(fd) {
const stream = require("node:fs").ReadStream.call(this, "", {
fd,
});
+ Object.setPrototypeOf(stream, ReadStream.prototype);
stream.isRaw = false;
- stream.isTTY = isatty(stream.fd);
+ stream.isTTY = true;
+
+ $assert(stream instanceof ReadStream);
return stream;
}
Object.defineProperty(ReadStream, "prototype", {
get() {
- const Real = require("node:fs").ReadStream.prototype;
+ const Prototype = Object.create(require("node:fs").ReadStream.prototype);
- Object.defineProperty(ReadStream, "prototype", { value: Real });
- ReadStream.prototype.setRawMode = function (flag) {
+ Prototype.setRawMode = function (flag) {
const mode = flag ? 1 : 0;
const err = ttySetMode(this.fd, mode);
if (err) {
- this.emit("error", new Error("setRawMode failed with errno:", err));
+ this.emit("error", new Error("setRawMode failed with errno: " + err));
return this;
}
this.isRaw = flag;
return this;
};
- return Real;
+ Object.defineProperty(ReadStream, "prototype", { value: Prototype });
+
+ return Prototype;
},
enumerable: true,
configurable: true,