Repository navigation
Releases
v0.6.1
Fixed
- Output written before the first
onDatalistener is no longer lost (#53, #54)- bun-pty keeps the newest 512 KiB of UTF-8, cut only between whole characters, and delivers it to the first listener (and any added in the same tick) just after
onData()returns - Before, a consumer that awaited anything between
spawn()andonData()lost the shell's first prompt, or all of a fast command's output - A consumer that subscribes in the same tick as
spawn()sees no change
- bun-pty keeps the newest 512 KiB of UTF-8, cut only between whole characters, and delivers it to the first listener (and any added in the same tick) just after
Changed
- The repository moved to sursatech/bun-pty. Old
sursaone/bun-ptylinks and clones redirect.
Thanks to @btriapitsyn for the contribution!
v0.6.0
⚠️ Breaking: Bun 1.4.0 or newer is required
bun-pty now uses the engine-native bun:ffi that arrived in Bun 1.4. On an older Bun, importing still works, and spawn() throws bun-pty needs Bun 1.4.0 or newer, but this is Bun 1.3.x. Run \bun upgrade`.`
bun upgradeThe JavaScript API is unchanged. If you build your own native library and point BUN_PTY_LIB at it, rebuild it from this version: the length argument of bun_pty_read and bun_pty_write is now usize.
Changed
- Bun 1.4's faster FFI (#52)
- Bun reports FFI calls up to 3x faster in 1.4, and hot call sites are JIT-compiled to direct C calls
- Reads and writes pass the buffer and its byte length as one view (
"buffer"+"buffer_length"), so the two cannot disagree - The command line and
cwdgo to the native library as plain strings - Library load failures now include the operating system's
dlerror()message
- README: a section on choosing between bun-pty and Bun's built-in
Bun.Terminal
Fixed
write("")no longer throwsbun:ffi cannot convert argument to 'ptr'on Bun 1.4 (#52)
Internal
@types/bun1.4.4,@types/node26.6.6, TypeScript 7.0.2,bun.lockv2, and updated Rust crates (portable-ptystays at 0.8.1 because of wezterm/wezterm#6783)- GitHub Actions on their current major versions, no persisted checkout credentials in the publish workflow, CI on Alpine 3.24 and on Bun 1.4.0, and a
bun checktype check
v0.5.2
Fixed
- A native library that fails to load now gets a clear error (#51)
spawn()throwsbun-pty could not load its native library at <path>: <dlopen error>instead ofundefined is not an object (evaluating 'lib.symbols')- Importing bun-pty no longer throws when no library file is found either; the error comes from
spawn(), and the load failure is still logged at import - Typical cause: a
bun build --compilebinary for musl that shipped the glibc library
Thanks @cat-miaw for the fix.
v0.5.1
Fixed
- Test files are left out of the npm package (#50)
"files"inpackage.jsonlists all ofsrc, and npm does not apply.npmignorepatterns to the paths it lists, so earlier tarballs included thesrc/*.test.tsfiles- No code changes since 0.5.0. See the 0.5.0 notes for the
envchange
v0.5.0
⚠️ Breaking: env replaces the child's environment
env is now the child's whole environment, as in node-pty, instead of being merged over the parent's. Variables you leave out, such as tokens, no longer reach the child (#47).
If you pass a partial map and rely on inheriting the rest, spread process.env:
spawn("bash", [], { name: "xterm-256color", env: { ...process.env, FOO: "bar" } });If you already pass { ...process.env, ... } or no env, nothing changes for you.
Changed
envreplaces the environment (#48)- Without
env, the child gets the currentprocess.env, so changes made at runtime reach it - When the map has no
PATH, a bare program name such asshis still found with the parent'sPATH, which does not reach the child - On Windows, a map with no entries keeps the parent's environment, as in node-pty
- Without
- The child's environment is built as node-pty builds it on Unix (#49)
TERMis set from thenameoption, which was ignored before, then fromTERMin the environment, then "xterm"PWDis set fromcwd- When the child inherits
process.env, the parent's tmux and screen variables (TMUX,STY, ...) and itsCOLUMNSandLINESare dropped
IPtyForkOptions.nameis optional, andenv: process.envnow type-checks (#49)
Thanks to @zgeoff for the report and the contribution!
v0.4.11
Added
- Native Windows ARM64 support (#46)
- Ships a pre-built
rust_pty_arm64.dll(built on GitHub'swindows-11-armrunner foraarch64-pc-windows-msvc) alongside the existing x64rust_pty.dll, whose filename is unchanged - Links the MSVC runtime statically (
-C target-feature=+crt-static) to avoid a Visual C++ Redistributable dependency - Selects the ARM64 DLL at runtime and in the
bun build --compileembed path, falling back torust_pty.dll - Adds a
windows-11-armjob to the test matrix that runs the unit and integration tests against the exact ARM64 artifact
- Ships a pre-built
Thanks to @dakehero for the contribution!
v0.4.10
Added
- musl libc support for Alpine Linux and other musl-based distros (#40)
- Ships pre-built musl variants (
librust_pty_musl.so/librust_pty_arm64_musl.so) alongside the existing glibc builds viacargo-zigbuildwith-C target-feature=-crt-static - Detects musl at runtime via
/proc/self/mapsand loads the appropriate.so - Adds
build-musl-lib+test-muslCI jobs that cross-compile on Ubuntu and run the resulting artifact inalpine:3.23 - Fixes #39
- Ships pre-built musl variants (
Thanks to @ncopa for the contribution!
v0.4.9
What's Changed
- chore: add nix flake configuration for reproducible builds by @MBanucu in #36
- fix(terminal): fix race condition preventing onData listeners from receiving data when set immediately after construction by @MBanucu in #37
- fix: don't treat transient read errors (EINTR/EWOULDBLOCK) as EOF in the reader thread by @Nibbler1250 in #42
New Contributors
- @MBanucu made their first contribution in #36
- @Nibbler1250 made their first contribution in #42
Full Changelog: v0.4.8...v0.4.9