1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 06:54:45 +03:00
Commit Graph

13 Commits

Author SHA1 Message Date
Wez Furlong
73a1c3b0d3
docs: add --help output pages to the CLI reference 2023-03-21 18:44:26 -07:00
Wez Furlong
53febb14ff pty: fixup for macos
e6421d1b72 removed this bit from the
example:

```
-
-    // Note that we're waiting until after we've read the output
-    // to call `wait` on the process.
-    // On macOS Catalina, waiting on the process seems to prevent
-    // its output from making it into the pty.
-    println!("child status: {:?}", child.wait().unwrap());
```

This commit revisits that and puts in place a differently horrible
solution for macos.

The issue is that if we don't put in a short sleep on macos, then
for a short lived process like `whoami` in this example, we end up
reading output like this:

```
; cargo run --example whoami
   Compiling portable-pty v0.8.0 (/Users/wez/wez-personal/wezterm/pty)
    Finished dev [unoptimized + debuginfo] target(s) in 0.60s
     Running `/Users/wez/wez-personal/wezterm/target/debug/examples/whoami`
child status: ExitStatus { code: 0, signal: None }
output: \r\n^D\u{8}\u{8}wez\r\n%
```

where the EOT that we send on Drop somehow gets *prepended* to the output
that we read from the pty with a couple of BELs thrown in.

I'm not sure WTF is happening on macOS for that to occur; feels like
some kind of race wrt. process startup and initializing the pty in the
system.

The reader has to be started before we close it as well, otherwise
the same issue can occur.
2022-08-12 08:37:20 -07:00
Wez Furlong
e6421d1b72 pty: try_clone_writer -> take_writer
This breaking API change allows us to explicitly generate EOF when the
taken writer is dropped.

The examples have been updated to show how to manage read, write
and waiting without deadlock for both linux and windows.
Need to confirm that this is still good on macOS, but my
confidence is high.

I've also removed ssh2 support from this crate as part of this
change. We haven't used it directly in wezterm in a long while
and removing it from here means that there is slightly less code
to keep compiling over and over.

refs: https://github.com/wez/wezterm/discussions/2392
refs: https://github.com/wez/wezterm/issues/1396
2022-08-12 07:56:46 -07:00
Wez Furlong
233adb5fe9 pty: update async example for more recent smol release 2020-10-03 11:15:57 -07:00
Wez Furlong
9d8839a6d9 pty: adjust examples for macOS Catalina
Seems that you need to have read everything you want before you
call waitpid, otherwise the pending data seems to be snipped and
prevented from being read.

closes: https://github.com/wez/wezterm/issues/187
2020-09-25 09:20:22 -07:00
Wez Furlong
2ef985aa18 pty: async example using smol
refs: https://github.com/wez/wezterm/issues/166
2020-05-09 11:24:14 -07:00
Wez Furlong
c54c64f395 pty: remove experimental awaitable bits 2020-05-09 11:24:14 -07:00
Wez Furlong
d84e8531a3 pty: implement awaitable conpty for windows
A bit of a PITA, but it appears to be functional
2020-01-20 15:23:56 -08:00
Wez Furlong
ca836ff95b pty: unix: add awaitable interface 2020-01-20 15:23:55 -08:00
Wez Furlong
82c824f371 pty: remove conpty support
It's too fiddly to setup in practice, and literally no one has
expressed an interest in using it.

Removing it simplifies some upcoming work.

Closes: https://github.com/wez/wezterm/issues/35
2020-01-20 07:55:51 -08:00
Wez Furlong
8055957406 clippy 2019-06-09 07:33:00 -07:00
Wez Furlong
3bf551706e improve pty example
Example output on linux:

```
child status: ExitStatus { successful: true }
output: wez\r\n%
```

Example output on windows:

```
child status: ExitStatus { successful: true }
output: \u{1b}[2J\u{1b}[?25l\u{1b}[m\u{1b}[HDOMAIN\\wez\u{8}\u{1b}]0;C:\\windows\\system32\\whoami.EXE\u{0}\u{7}\u{1b}[?25h
```

Refs: https://github.com/wez/wezterm/issues/27
2019-05-21 08:58:42 -07:00
Wez Furlong
015a97e2be add pty example that runs whoami
Refs: https://github.com/wez/wezterm/issues/27
2019-05-20 07:20:47 -07:00