aboutsummaryrefslogtreecommitdiffstats
path: root/examples/basic.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/basic.rs
parentf8780ca1e76286688b74d8a6c64d5fadf3cfd2a1 (diff)
downloadpty-process-3b550f5d3dad77a56455352579fae3071b42e86d.tar.gz
pty-process-3b550f5d3dad77a56455352579fae3071b42e86d.zip
wip another complete refactor
Diffstat (limited to 'examples/basic.rs')
-rw-r--r--examples/basic.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/examples/basic.rs b/examples/basic.rs
index 1e5913b..c9b5f6c 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -1,11 +1,10 @@
mod raw_guard;
-#[cfg(feature = "backend-std")]
mod main {
use std::io::{Read as _, Write as _};
use std::os::unix::io::AsRawFd as _;
- pub fn run(child: &mut pty_process::std::Child) {
+ pub fn run(child: &mut pty_process::blocking::Child) {
let _raw = super::raw_guard::RawGuard::new();
let mut buf = [0_u8; 4096];
let pty = child.pty().as_raw_fd();
@@ -70,15 +69,15 @@ mod main {
}
}
-#[cfg(feature = "backend-std")]
fn main() {
use std::os::unix::process::ExitStatusExt as _;
- let pty = pty_process::std::Pty::new().unwrap();
+ let pty = pty_process::blocking::Pty::new().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
- let mut cmd = pty_process::std::Command::new("tac");
- // cmd.args(&["500"]);
- let mut child = cmd.spawn(pty).unwrap();
+ let mut child = pty_process::blocking::Command::new("tac")
+ // .args(&["500"])
+ .spawn(pty)
+ .unwrap();
main::run(&mut child);
@@ -89,8 +88,3 @@ fn main() {
.unwrap_or_else(|| status.signal().unwrap_or(0) + 128),
);
}
-
-#[cfg(not(feature = "backend-std"))]
-fn main() {
- unimplemented!()
-}