fix(core): use dev tty for crossterm (#30696)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

`git push -u origin HEAD` causes the following panic when the TUI is
enabled on macos:

```
Backtrace (most recent call last):
  File "<unknown>:0", in __pthread_cond_wait
  File "<unknown>:0", in std::sys::pal::unix:🧵:Thread:🆕:thread_start
  File "<unknown>:0", in core::ops::function::FnOnce::call_once{{vtable.shim}}
  File "<unknown>:0", in std::sys::backtrace::__rust_begin_short_backtrace
  File "<unknown>:0", in tokio::runtime::task::raw::poll
  File "<unknown>:0", in tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  File "<unknown>:0", in tokio::runtime::task::raw::poll
  File "<unknown>:0", in tokio::runtime::task::core::Core<T,S>::poll
  File "<unknown>:0", in nx::native::tui::tui::Tui::start::{{closure}}
  File "<unknown>:0", in core::option::expect_failed

The application panicked (crashed).
  reader source not set
in /Users/jason/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossterm-0.29.0/src/event/read.rs:39
thread: tokio-runtime-worker

```

This is due to the fact that crossterm until recently did not use
/dev/tty on mac and thus could not read events correctly when forwarded
from another program such as husky.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

This adds the `use-dev-tty` features so that `crossterm` utilizes
`/dev/tty` and works when forwarded from other programs such as husky on
macos.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jason Jean 2025-04-11 22:35:26 -04:00
parent 9359490326
commit 46888b294c
2 changed files with 95 additions and 37 deletions

130
Cargo.lock generated
View File

@ -240,7 +240,7 @@ version = "0.69.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"cexpr",
"clang-sys",
"itertools 0.10.5",
@ -265,9 +265,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.6.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "bitvec"
@ -510,6 +510,15 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "convert_case"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@ -561,16 +570,15 @@ checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crossterm"
version = "0.27.0"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"crossterm_winapi",
"futures-core",
"libc",
"mio 0.8.11",
"mio 1.0.3",
"parking_lot",
"rustix 0.38.38",
"signal-hook",
"signal-hook-mio",
"winapi",
@ -578,15 +586,19 @@ dependencies = [
[[package]]
name = "crossterm"
version = "0.28.1"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"crossterm_winapi",
"derive_more",
"document-features",
"filedescriptor 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core",
"mio 1.0.3",
"parking_lot",
"rustix 0.38.38",
"rustix 1.0.5",
"signal-hook",
"signal-hook-mio",
"winapi",
@ -669,6 +681,27 @@ dependencies = [
"powerfmt",
]
[[package]]
name = "derive_more"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
"convert_case 0.7.1",
"proc-macro2",
"quote",
"syn 2.0.100",
]
[[package]]
name = "difflib"
version = "0.4.0"
@ -681,6 +714,15 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "document-features"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
dependencies = [
"litrs",
]
[[package]]
name = "downcast-rs"
version = "1.2.0"
@ -785,6 +827,17 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "filedescriptor"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d"
dependencies = [
"libc",
"thiserror",
"winapi",
]
[[package]]
name = "filedescriptor"
version = "0.8.3"
@ -1049,7 +1102,7 @@ version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbd06203b1a9b33a78c88252a625031b094d9e1b647260070c25b09910c0a804"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"bstr",
"gix-path",
"libc",
@ -1097,7 +1150,7 @@ version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"bstr",
"gix-features",
"gix-path",
@ -1183,7 +1236,7 @@ version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fddc27984a643b20dd03e97790555804f98cf07404e0e552c0ad8133266a79a1"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"gix-path",
"libc",
"windows-sys 0.52.0",
@ -1253,7 +1306,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"ignore",
"walkdir",
]
@ -1706,6 +1759,12 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413"
[[package]]
name = "litrs"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
[[package]]
name = "lock_api"
version = "0.4.11"
@ -1861,7 +1920,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3"
dependencies = [
"anyhow",
"bitflags 2.6.0",
"bitflags 2.9.0",
"chrono",
"ctor",
"napi-derive",
@ -1883,7 +1942,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c"
dependencies = [
"cfg-if",
"convert_case",
"convert_case 0.6.0",
"napi-derive-backend",
"proc-macro2",
"quote",
@ -1896,7 +1955,7 @@ version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf"
dependencies = [
"convert_case",
"convert_case 0.6.0",
"once_cell",
"proc-macro2",
"quote",
@ -1949,7 +2008,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"cfg-if",
"libc",
]
@ -1976,7 +2035,7 @@ version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"crossbeam-channel",
"filetime",
"fsevent-sys",
@ -2074,7 +2133,7 @@ dependencies = [
"color-eyre",
"colored",
"crossbeam-channel",
"crossterm 0.27.0",
"crossterm 0.29.0",
"dashmap",
"dunce",
"flate2",
@ -2142,7 +2201,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5906f93257178e2f7ae069efb89fbd6ee94f0592740b5f8a1512ca498814d0fb"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"objc2",
"objc2-core-graphics",
"objc2-foundation",
@ -2154,7 +2213,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"objc2",
]
@ -2164,7 +2223,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dca602628b65356b6513290a21a6405b4d4027b8b250f0b98dddbb28b7de02"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"objc2",
"objc2-core-foundation",
"objc2-io-surface",
@ -2182,7 +2241,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a21c6c9014b82c39515db5b396f91645182611c97d24637cf56ac01e5f8d998"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"objc2",
"objc2-core-foundation",
]
@ -2193,7 +2252,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "161a8b87e32610086e1a7a9e9ec39f84459db7b3a0881c1f16ca5a2605581c19"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"objc2",
"objc2-core-foundation",
]
@ -2318,7 +2377,7 @@ dependencies = [
"anyhow",
"bitflags 1.3.2",
"downcast-rs",
"filedescriptor",
"filedescriptor 0.8.3 (git+https://github.com/cammisuli/wezterm?rev=b538ee29e1e89eeb4832fb35ae095564dce34c29)",
"lazy_static",
"libc",
"log",
@ -2580,7 +2639,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"cassowary",
"compact_str",
"crossterm 0.28.1",
@ -2769,7 +2828,7 @@ version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
@ -2801,7 +2860,7 @@ version = "0.38.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"errno",
"libc",
"linux-raw-sys 0.4.14",
@ -2814,7 +2873,7 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"errno",
"libc",
"linux-raw-sys 0.9.3",
@ -3046,7 +3105,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd"
dependencies = [
"libc",
"mio 0.8.11",
"mio 1.0.3",
"signal-hook",
]
@ -3257,7 +3315,7 @@ version = "0.107.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6528f3dd33e11eae9d7fe9fee4a79d5bbd211c74426ab2eec64dc82bd2eb74d"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
"is-macro",
"num-bigint",
"scoped-tls",
@ -4495,7 +4553,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.9.0",
]
[[package]]

View File

@ -66,7 +66,7 @@ mio = "0.8"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
arboard = "3.4.1"
crossterm = { version = "0.27.0", features = ["event-stream"] }
crossterm = { version = "0.29.0", features = ["event-stream", "use-dev-tty"] }
portable-pty = { git = "https://github.com/cammisuli/wezterm", rev = "b538ee29e1e89eeb4832fb35ae095564dce34c29" }
ignore-files = "2.1.0"
fs4 = "0.12.0"