-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for dumping motd on session creation
This patch adds support for one of the two motd modes that I plan to support. In this basic "dump" mode, we only display the message of the day when a user first creates a session. Since we are doing it right at the beginning, we can be confident we won't be mangling the restore buffer. Directly injecting the message of the day into the output stream is much more fraught on reconnect. I was hoping that this would be a simple change, but it would up being quite a bit more involved than I had hoped. The main reason for this is the interaction between the prompt prefix injection and message of the day injection. We need to make sure that motd injection happens after the prompt prefix shell code has finished executing so that it does not get clobbered, but unfortunately this is not as easy as just doing one after the other. With the naive approach there is a race condition where first we write the prefix injection shell code to the shell process, then we write out the message of the day, then the shell finishes processing the shell code and issues the terminal reset code emitted by the `clear` command at the end of the prompt prefix shell code. To deal with this, I started scanning for the control code emitted by `clear` in the output stream. I was able to re-use the efficient trie I wrote for the keybindings engine to do this. This addresses the first part of #5, but the issue is not resolved yet. I also realized that two different config variables to control this behavior leaves too much room for weird states. In particular, I worried about doing a direct dump during reattach. I decided it is better to do everything via one variable, where the mode implies when we actually show the motd.
- Loading branch information
1 parent
510817b
commit bc11d20
Showing
25 changed files
with
859 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
name: presubmit | ||
on: [push, pull_request, workflow_call, workflow_dispatch] | ||
on: [pull_request, workflow_call, workflow_dispatch] | ||
|
||
jobs: | ||
test: | ||
name: cargo test --all-features | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: moonrepo/setup-rust@v1 | ||
- uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f | ||
with: | ||
channel: '1.74.0' | ||
- run: sudo apt-get install zsh fish | ||
- run: cargo test --all-features | ||
- uses: actions/upload-artifact@v4 | ||
- run: sudo apt-get install zsh fish libpam0g-dev | ||
- run: SHPOOL_LEAVE_TEST_LOGS=true cargo test --all-features | ||
- name: Archive Logs | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
id: artifact-upload-step | ||
with: | ||
name: test-logs | ||
path: /tmp/shpool-test*/*.log | ||
|
||
# miri does not handle all the IO we do, disabled for now. | ||
# | ||
# | ||
# miri: | ||
# name: cargo +nightly miri test | ||
# runs-on: ubuntu-22.04 | ||
|
@@ -36,32 +39,34 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: moonrepo/setup-rust@v1 | ||
- uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f | ||
with: | ||
components: rustfmt | ||
channel: nightly | ||
- run: sudo apt-get install libpam0g-dev | ||
- run: cargo +nightly fmt -- --check | ||
|
||
cranky: | ||
name: cargo +nightly cranky --all-targets -- -D warnings | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: moonrepo/setup-rust@v1 | ||
- uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f | ||
with: | ||
components: clippy | ||
bins: [email protected] | ||
channel: nightly | ||
- run: sudo apt-get install zsh fish | ||
- run: sudo apt-get install zsh fish libpam0g-dev | ||
- run: cargo +nightly cranky --all-targets -- -D warnings | ||
|
||
deny: | ||
name: cargo deny --all-features check licenses | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: moonrepo/setup-rust@v1 | ||
- uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f | ||
with: | ||
channel: '1.74.0' | ||
bins: cargo-deny | ||
- run: sudo apt-get install libpam0g-dev | ||
- run: cargo deny --all-features check licenses |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
[advisories] | ||
db-path = "~/.cargo/advisory-db" | ||
db-urls = ["https://github.com/rustsec/advisory-db"] | ||
vulnerability = "deny" | ||
unmaintained = "deny" | ||
yanked = "deny" | ||
notice = "deny" | ||
ignore = [ | ||
] | ||
|
||
[licenses] | ||
unlicensed = "deny" | ||
allow = [ | ||
"Apache-2.0", | ||
"MIT", | ||
"Unicode-DFS-2016", | ||
] | ||
copyleft = "deny" | ||
default = "deny" | ||
confidence-threshold = 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.