1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore(test_util): use pty2 instead of pty (#17131)

Fixes https://github.com/denoland/deno/issues/484

Removes dependency on winapi 0.2.x versions.
This commit is contained in:
Divy Srivastava 2022-12-19 10:12:45 -08:00 committed by GitHub
parent 118a35f3bc
commit 5a8adc342b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 76 deletions

113
Cargo.lock generated
View file

@ -198,7 +198,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -421,7 +421,7 @@ dependencies = [
"iana-time-zone",
"num-integer",
"num-traits",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -486,7 +486,7 @@ checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219"
dependencies = [
"error-code",
"str-buf",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -690,7 +690,7 @@ checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759"
dependencies = [
"bitflags",
"libloading",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -841,7 +841,7 @@ dependencies = [
"typed-arena",
"uuid",
"walkdir",
"winapi 0.3.9",
"winapi",
"winres",
"zstd",
]
@ -1035,7 +1035,7 @@ dependencies = [
"libffi",
"serde",
"tokio",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1214,7 +1214,7 @@ dependencies = [
"test_util",
"tokio",
"uuid",
"winapi 0.3.9",
"winapi",
"winres",
]
@ -1392,7 +1392,7 @@ dependencies = [
"dlopen_derive",
"lazy_static",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1606,17 +1606,6 @@ dependencies = [
"termcolor",
]
[[package]]
name = "errno"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e2b2decb0484e15560df3210cf0d78654bb0864b2c138977c07e377a1bae0e2"
dependencies = [
"kernel32-sys",
"libc",
"winapi 0.2.8",
]
[[package]]
name = "errno"
version = "0.2.8"
@ -1625,7 +1614,7 @@ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1819,7 +1808,7 @@ checksum = "fb17cf6ed704f72485332f6ab65257460c4f9f3083934cf402bf9f5b3b600a90"
dependencies = [
"libc",
"rustc_version 0.2.3",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1838,7 +1827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57eafdd0c16f57161105ae1b98a1238f97645f2f588438b2949c99a2af9616bf"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2161,7 +2150,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867"
dependencies = [
"libc",
"match_cfg",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2252,7 +2241,7 @@ dependencies = [
"js-sys",
"once_cell",
"wasm-bindgen",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2372,7 +2361,7 @@ checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98"
dependencies = [
"socket2",
"widestring",
"winapi 0.3.9",
"winapi",
"winreg 0.7.0",
]
@ -2444,17 +2433,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be39922b087cecaba4e2d5592dedfc8bda5d4a5a1231f143337cca207950b61d"
dependencies = [
"scopeguard",
"winapi 0.3.9",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
"winapi",
]
[[package]]
@ -2602,7 +2581,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
dependencies = [
"cfg-if",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2840,7 +2819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29a01b9f018d6b7b277fef6c79fdbd9bf17bb2d1e298238055cafab49baa5ee"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2885,7 +2864,7 @@ dependencies = [
"libc",
"mio",
"walkdir",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2894,7 +2873,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3020,7 +2999,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c92f2b54f081d635c77e7120862d48db8e91f7f21cef23ab1b4fe9971c59f55"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3035,7 +3014,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3098,7 +3077,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3386,12 +3365,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d"
[[package]]
name = "pty"
version = "0.2.2"
name = "pty2"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f50f3d255966981eb4e4c5df3e983e6f7d163221f547406d83b6a460ff5c5ee8"
checksum = "4461e7f96399674b9112e620e511089bc7c4c0d76545b3cc3e0b46bab72a15d5"
dependencies = [
"errno 0.1.8",
"errno",
"libc",
]
@ -3538,7 +3517,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3628,7 +3607,7 @@ dependencies = [
"spin",
"untrusted",
"web-sys",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3707,7 +3686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada"
dependencies = [
"bitflags",
"errno 0.2.8",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
@ -3766,7 +3745,7 @@ dependencies = [
"unicode-segmentation",
"unicode-width",
"utf8parse",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -4069,7 +4048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -4671,7 +4650,7 @@ dependencies = [
"libc",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -4716,7 +4695,7 @@ dependencies = [
"os_pipe",
"parking_lot 0.12.1",
"pretty_assertions",
"pty",
"pty2",
"regex",
"reqwest",
"ring",
@ -4729,7 +4708,7 @@ dependencies = [
"tokio-rustls",
"tokio-tungstenite",
"url",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -4833,7 +4812,7 @@ dependencies = [
"signal-hook-registry",
"socket2",
"tokio-macros",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -5407,7 +5386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
"same-file",
"winapi 0.3.9",
"winapi",
"winapi-util",
]
@ -5590,7 +5569,7 @@ dependencies = [
"wasm-bindgen",
"web-sys",
"wgpu-types",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -5621,12 +5600,6 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -5637,12 +5610,6 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -5655,7 +5622,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -5713,7 +5680,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -5722,7 +5689,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]

View file

@ -40,7 +40,7 @@ tokio-tungstenite.workspace = true
url.workspace = true
[target.'cfg(unix)'.dependencies]
pty = "0.2.2"
pty2 = "0.1.0"
[target.'cfg(windows)'.dependencies]
winapi = { workspace = true, features = ["consoleapi", "synchapi", "handleapi", "namedpipeapi", "winbase", "winerror"] }

View file

@ -24,7 +24,7 @@ pub fn create_pty(
cwd: impl AsRef<Path>,
env_vars: Option<HashMap<String, String>>,
) -> Box<dyn Pty> {
let fork = pty::fork::Fork::from_ptmx().unwrap();
let fork = pty2::fork::Fork::from_ptmx().unwrap();
if fork.is_parent().is_ok() {
Box::new(unix::UnixPty { fork })
} else {
@ -48,7 +48,7 @@ mod unix {
use super::Pty;
pub struct UnixPty {
pub fork: pty::fork::Fork,
pub fork: pty2::fork::Fork,
}
impl Drop for UnixPty {