shell-pool / shpool

Think tmux, then aim... lower
Apache License 2.0
1.18k stars 20 forks source link

fix: suppress prompt setup in screen restore #141

Closed ethanpailes closed 2 months ago

ethanpailes commented 2 months ago

This patch starts correctly suppressing the prompt setup code during screen restore. Previously, we were just suppressing it in terms of the data we initially stream to the user, but if you create a new session, then disconnect, then reconnect, the setup code would be visible. The fix is to avoid pumping data into the in-memory term until after we've seen the prompt setup sentinel.

I tested that the tweaked test in this patch failes without the application change to ensure that it is really testing what we want. I also observed this patch working with manual testing.

Fixes #120

Aetf commented 2 months ago
error: this expression creates a reference which is immediately dereferenced by the compiler
   --> shpool/tests/support/line_matcher.rs:173:36
    |
173 |             if nomatch_re.is_match(&line) {
    |                                    ^^^^^ help: change this to: `line`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`