aboutsummaryrefslogtreecommitdiffstats
path: root/examples/smol.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-29 02:55:24 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-29 03:52:12 -0500
commit3b550f5d3dad77a56455352579fae3071b42e86d (patch)
tree393de5f206d227ec71149f478db900291357c456 /examples/smol.rs
parentf8780ca1e76286688b74d8a6c64d5fadf3cfd2a1 (diff)
downloadpty-process-3b550f5d3dad77a56455352579fae3071b42e86d.tar.gz
pty-process-3b550f5d3dad77a56455352579fae3071b42e86d.zip
wip another complete refactor
Diffstat (limited to 'examples/smol.rs')
-rw-r--r--examples/smol.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/smol.rs b/examples/smol.rs
index b0b90e4..e8b1c4c 100644
--- a/examples/smol.rs
+++ b/examples/smol.rs
@@ -1,11 +1,11 @@
mod raw_guard;
-#[cfg(feature = "backend-smol")]
+#[cfg(feature = "async")]
mod main {
use smol::io::{AsyncReadExt as _, AsyncWriteExt as _};
pub async fn run(
- child: &mut pty_process::smol::Child,
+ child: &pty_process::Child,
) -> std::result::Result<(), Box<dyn std::error::Error>> {
let _raw = super::raw_guard::RawGuard::new();
@@ -54,17 +54,18 @@ mod main {
}
}
-#[cfg(feature = "backend-smol")]
+#[cfg(feature = "async")]
fn main() {
use std::os::unix::process::ExitStatusExt as _;
let status = smol::block_on(async {
- let pty = pty_process::smol::Pty::new().unwrap();
+ let pty = pty_process::Pty::new().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
- let mut cmd = pty_process::smol::Command::new("tac");
- // cmd.args(&["500"]);
- let mut child = cmd.spawn(pty).unwrap();
- main::run(&mut child).await.unwrap();
+ let mut child = pty_process::Command::new("tac")
+ // .args(&["500"])
+ .spawn(pty)
+ .unwrap();
+ main::run(&child).await.unwrap();
child.status().await.unwrap()
});
std::process::exit(
@@ -74,7 +75,7 @@ fn main() {
);
}
-#[cfg(not(feature = "backend-smol"))]
+#[cfg(not(feature = "async"))]
fn main() {
unimplemented!()
}