diff --git a/Cargo.lock b/Cargo.lock index f18f1fe01..17e15b933 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,6 +148,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +[[package]] +name = "async-barrier" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04b50fe84d0aea412a4e751cb01b9e26e2be533b2708607c2a2a739b192ee45a" +dependencies = [ + "async-mutex", + "event-listener", +] + [[package]] name = "async-channel" version = "1.4.2" @@ -168,11 +178,21 @@ dependencies = [ "async-task 4.0.2", "concurrent-queue", "fastrand", - "futures-lite 1.8.0", + "futures-lite", "once_cell", "vec-arena", ] +[[package]] +name = "async-fs" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3572236ba37147ca2b674a0bd5afd20aec0cd925ab125ab6fad6543960f9002" +dependencies = [ + "blocking", + "futures-lite", +] + [[package]] name = "async-global-executor" version = "1.3.0" @@ -181,7 +201,7 @@ checksum = "fefeb39da249f4c33af940b779a56723ce45809ef5c54dad84bb538d4ffb6d9e" dependencies = [ "async-executor", "async-io", - "futures-lite 1.8.0", + "futures-lite", "num_cpus", "once_cell", ] @@ -194,16 +214,28 @@ checksum = "b5bfd63f6fc8fd2925473a147d3f4d252c712291efdde0d7057b25146563402c" dependencies = [ "concurrent-queue", "fastrand", - "futures-lite 1.8.0", + "futures-lite", "log", "nb-connect", "once_cell", - "parking 2.0.0", + "parking", "polling", "vec-arena", "waker-fn", ] +[[package]] +name = "async-lock" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76000290eb3c67dfe4e2bdf6b6155847f8e16fc844377a7bd0b5e97622656362" +dependencies = [ + "async-barrier", + "async-mutex", + "async-rwlock", + "async-semaphore", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -213,6 +245,53 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-net" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14a5335056541826f855bf95b936df9788adbacf94b15ef7104029f7fff3e82a" +dependencies = [ + "async-io", + "blocking", + "fastrand", + "futures-lite", +] + +[[package]] +name = "async-process" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb915df28b8309139bd9c9c700d84c20e5c21385d05378caa84912332d0f6a1" +dependencies = [ + "async-io", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "once_cell", + "signal-hook", + "winapi 0.3.9", +] + +[[package]] +name = "async-rwlock" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261803dcc39ba9e72760ba6e16d0199b1eef9fc44e81bffabbebb9f5aea3906c" +dependencies = [ + "async-mutex", + "event-listener", +] + +[[package]] +name = "async-semaphore" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "538c756e85eb6ffdefaec153804afb6da84b033e2e5ec3e9d459c34b4bf4d3f6" +dependencies = [ + "event-listener", +] + [[package]] name = "async-std" version = "1.6.5" @@ -222,12 +301,12 @@ dependencies = [ "async-global-executor", "async-io", "async-mutex", - "blocking 1.0.0", + "blocking", "crossbeam-utils 0.7.2", "futures-channel", "futures-core", "futures-io", - "futures-lite 1.8.0", + "futures-lite", "gloo-timers", "kv-log-macro", "log", @@ -250,12 +329,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "async-task" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" - [[package]] name = "async-task" version = "4.0.2" @@ -368,20 +441,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[package]] -name = "blocking" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2468ff7bf85066b4a3678fede6fe66db31846d753ff0adfbfab2c6a6e81612b" -dependencies = [ - "async-channel", - "atomic-waker", - "futures-lite 0.1.11", - "once_cell", - "parking 1.0.6", - "waker-fn", -] - [[package]] name = "blocking" version = "1.0.0" @@ -391,7 +450,7 @@ dependencies = [ "async-channel", "atomic-waker", "fastrand", - "futures-lite 1.8.0", + "futures-lite", "once_cell", "waker-fn", ] @@ -1238,21 +1297,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" -[[package]] -name = "futures-lite" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97999970129b808f0ccba93211201d431fcc12d7e1ffae03a61b5cedd1a7ced2" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking 2.0.0", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-lite" version = "1.8.0" @@ -1263,7 +1307,7 @@ dependencies = [ "futures-core", "futures-io", "memchr", - "parking 2.0.0", + "parking", "pin-project-lite", "waker-fn", ] @@ -2330,12 +2374,6 @@ dependencies = [ "syn 1.0.42", ] -[[package]] -name = "parking" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb300f271742d4a2a66c01b6b2fa0c83dfebd2e0bf11addb879a3547b4ed87c" - [[package]] name = "parking" version = "2.0.0" @@ -3209,23 +3247,20 @@ dependencies = [ [[package]] name = "smol" -version = "0.1.18" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5" +checksum = "7ca2722989073e89917a575862fb49dba3321af152f0cf4a4164d9482aabdf28" dependencies = [ - "async-task 3.0.0", - "blocking 0.4.7", - "concurrent-queue", - "fastrand", - "futures-io", - "futures-util", - "libc", + "async-channel", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-net", + "async-process", + "blocking", + "futures-lite", "once_cell", - "scoped-tls", - "slab", - "socket2", - "wepoll-sys-stjepang", - "winapi 0.3.9", ] [[package]] diff --git a/pty/Cargo.toml b/pty/Cargo.toml index 2da3fb294..d0b460564 100644 --- a/pty/Cargo.toml +++ b/pty/Cargo.toml @@ -39,5 +39,5 @@ winapi = { version = "0.3", features = [ ]} [dev-dependencies] -smol = "0.1" +smol = "1.2" futures = "0.3" diff --git a/pty/examples/whoami_async.rs b/pty/examples/whoami_async.rs index 9dbad9421..26d5d595a 100644 --- a/pty/examples/whoami_async.rs +++ b/pty/examples/whoami_async.rs @@ -6,7 +6,7 @@ use portable_pty::{native_pty_system, CommandBuilder, PtySize}; // in an asynchronous application. fn main() -> anyhow::Result<()> { - smol::run(async { + smol::block_on(async { let pty_system = native_pty_system(); let pair = pty_system.openpty(PtySize { @@ -24,7 +24,7 @@ fn main() -> anyhow::Result<()> { // file handles which is important to avoid deadlock // when waiting for the child process! let slave = pair.slave; - let mut child = smol::blocking!(slave.spawn_command(cmd))?; + let mut child = smol::unblock(move || slave.spawn_command(cmd)).await?; let reader = pair.master.try_clone_reader()?; @@ -36,7 +36,7 @@ fn main() -> anyhow::Result<()> { // waiting for a future child that will never be spawned. drop(pair.master); - let mut lines = futures::io::BufReader::new(smol::reader(reader)).lines(); + let mut lines = smol::io::BufReader::new(smol::Unblock::new(reader)).lines(); while let Some(line) = lines.next().await { let line = line.map_err(|e| anyhow!("problem reading line: {}", e))?; // We print with escapes escaped because the windows conpty @@ -56,9 +56,10 @@ fn main() -> anyhow::Result<()> { // its output from making it into the pty. println!( "child status: {:?}", - smol::blocking!(child + smol::unblock(move || child .wait() - .map_err(|e| anyhow!("waiting for child: {}", e)))? + .map_err(|e| anyhow!("waiting for child: {}", e))) + .await? ); Ok(()) })