diff options
author | 2023-08-28 20:08:08 -0700 | |
---|---|---|
committer | 2023-08-28 20:08:08 -0700 | |
commit | d1c2d6b25ceaeb58513d8687ba7945447adb6618 (patch) | |
tree | 19292e163ea1bb3caaa58b25c8bc1478c16ab50a /src/js/node/tty.js | |
parent | a2aad40171292914bef924f12172ae00049fcef4 (diff) | |
download | bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.tar.gz bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.tar.zst bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.zip |
use `options.fd` if provided for `fs.Read/WriteStream` (#4378)
* use `options.fd` over path
* tests
* fix `@clack/prompts`
* == null
Diffstat (limited to 'src/js/node/tty.js')
-rw-r--r-- | src/js/node/tty.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/js/node/tty.js b/src/js/node/tty.js index 09010e8fc..d5645c6da 100644 --- a/src/js/node/tty.js +++ b/src/js/node/tty.js @@ -4,7 +4,9 @@ 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"); - const stream = require("node:fs").ReadStream.call(this, `/dev/fd/${fd}`); + const stream = require("node:fs").ReadStream.call(this, "", { + fd, + }); stream.isRaw = false; stream.isTTY = isatty(stream.fd); @@ -93,7 +95,9 @@ 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, `/dev/fd/${fd}`); + const stream = require("node:fs").WriteStream.call(this, "", { + fd, + }); stream.columns = undefined; stream.rows = undefined; |