mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
* Fixes #6929 * TIL macOS symbols are case insensitive --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
19 lines
520 B
JavaScript
19 lines
520 B
JavaScript
const onlyCheck = process.env.ONLY_CHECK_TTY === "0";
|
|
import { dlopen, ptr } from "bun:ffi";
|
|
|
|
const suffix = process.platform === "darwin" ? "dylib" : "so.6";
|
|
const { tcgetattr, tcsetattr } = dlopen(`libc.${suffix}`, {
|
|
"tcgetattr": {
|
|
"args": ["int", "pointer"],
|
|
"result": "int",
|
|
},
|
|
}).symbols;
|
|
var termios = new Buffer(256);
|
|
var dataView = new DataView(termios.buffer);
|
|
const rc = tcgetattr(0, dataView);
|
|
if (rc === 0) {
|
|
throw new Error("tcgetattr failed");
|
|
}
|
|
|
|
await Bun.write(1, termios.toString("hex"));
|