bun
bun copied to clipboard
Implement `tty.WriteStream`
Some of tty.WriteStream may already be implemented, but there are some missing pieces.
4 | const settings_1 = require("./settings");
5 | function termwidth(stream) {
6 | if (!stream.isTTY) {
7 | return 80;
8 | }
9 | const width = stream.getWindowSize()[0];
^
TypeError: stream.getWindowSize is not a function. (In 'stream.getWindowSize()', 'stream.getWindowSize' is undefined)
at termwidth (/node_modules/@oclif/core/lib/screen.js:9:18)
at /node_modules/@oclif/core/lib/screen.js:19:34
This blocks the oclif CLI parser from working.
Some related issues:
- #1787
- #1774
- #2040 possibly
I think this will be easy to do once I finish setting the framework up around TTY stuff in #2025
Also, if someone wants to use oclif, here's a temporary workaround:
// HACK: https://github.com/oven-sh/bun/issues/2081
process.stdout.getWindowSize = () => [80, 80];
process.stderr.getWindowSize = () => [80, 80];
import { Command, Flags } from "@oclif/core";
// ...
Of course, we will fix this in Bun so you don't need to do this.
FWIW this breaks many packages such as https://www.npmjs.com/package/clipanion sadly.