diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-11 03:25:04 -0800 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-11 03:25:04 -0800 |
commit | 44b4d324a0176033107789d1421549b24898ac8a (patch) | |
tree | 342631e076e07a6811854208f01d0bdc56021a50 /src/main.rs | |
parent | 6ec1028c9c541047f5e9d324bc14d37fccaa36e0 (diff) |
graceful shutdown, fix profile corruption bug
profile corruption was trailing json left by not truncating when profile shrinks in size
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index d69d67d..37f190e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -383,7 +383,15 @@ fn do_ui(ui_rx_orig: chan::Receiver<Result<termion::event::Event, std::io::Error tw::AppState::Reconnect => { tweeter.state = tw::AppState::View; return Some((ui_rx_orig.clone(), tweeter.profile.clone().map(|creds| connect_twitter_stream(tweeter.app_key.clone(), creds)))); - } + }, + tw::AppState::Shutdown => { + tweeter.display_info.status("Saving cache...".to_owned()); + display::paint(tweeter).unwrap(); + tweeter.store_cache(); + tweeter.display_info.status("Bye bye!".to_owned()); + display::paint(tweeter).unwrap(); + return None + }, _ => () }; } |