diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2020-12-02 14:03:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 15:03:46 +0100 |
| commit | c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea (patch) | |
| tree | 699f8bfb9f3fb3898b449b43bf6bb53278a443ea /src/screen.rs | |
| parent | fic(compatibility): htop scrolling issues (#77) (diff) | |
| download | sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.gz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.xz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.zip | |
fix(threads): a race condition, build-times, and warnings (#79)
* Fix a race condition, build-times, and warnings
* Yeah, yeah... I know
* style(code): add comment to explain race condition
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'src/screen.rs')
| -rw-r--r-- | src/screen.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/screen.rs b/src/screen.rs index 53655216..56bb82d2 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -380,8 +380,14 @@ impl Screen { } } pub fn handle_pty_event(&mut self, pid: RawFd, event: VteEvent) { - let terminal_output = self.terminals.get_mut(&pid).unwrap(); - terminal_output.handle_event(event); + // if we don't have the terminal in self.terminals it's probably because + // of a race condition where the terminal was created in pty_bus but has not + // yet been created in Screen. These events are currently not buffered, so + // if you're debugging seemingly randomly missing stdout data, this is + // the reason + if let Some(terminal_output) = self.terminals.get_mut(&pid) { + terminal_output.handle_event(event); + } } pub fn write_to_active_terminal(&mut self, mut bytes: Vec<u8>) { if let Some(active_terminal_id) = &self.get_active_terminal_id() { |
