-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix!: Perform a clean exit again #2463
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b9ca216
Don't request exit multiple times
fredizzimo 66a85d5
Wait until the Neovim exits before exiting the event loop
fredizzimo 2bee0b4
Fix exit crash on Wayland
fredizzimo 4d164ee
Disable detach when the window is closed for remote connections
fredizzimo 098b6ff
Wait for all tasks to exits, so that logs don't go to stderr
fredizzimo 686d8a1
Force quit after some timeout, when the neovim process quits
fredizzimo 522375b
Add some logging
fredizzimo 07f00c6
Clean up the io stream wait code
fredizzimo 35582e8
Simplify the code, let the runtime shutdown the UICommand tasks
fredizzimo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
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,5 +1,5 @@ | ||
use std::sync::{ | ||
atomic::{AtomicBool, AtomicI32, Ordering}, | ||
atomic::{AtomicI32, Ordering}, | ||
Arc, | ||
}; | ||
|
||
|
@@ -10,34 +10,26 @@ lazy_static! { | |
} | ||
|
||
pub struct RunningTracker { | ||
running: Arc<AtomicBool>, | ||
exit_code: Arc<AtomicI32>, | ||
} | ||
|
||
impl RunningTracker { | ||
fn new() -> Self { | ||
Self { | ||
running: Arc::new(AtomicBool::new(true)), | ||
exit_code: Arc::new(AtomicI32::new(0)), | ||
} | ||
} | ||
|
||
pub fn quit(&self, reason: &str) { | ||
self.running.store(false, Ordering::Relaxed); | ||
info!("Quit {}", reason); | ||
} | ||
|
||
pub fn quit_with_code(&self, code: i32, reason: &str) { | ||
self.exit_code.store(code, Ordering::Relaxed); | ||
self.running.store(false, Ordering::Relaxed); | ||
self.exit_code.store(code, Ordering::Release); | ||
info!("Quit with code {}: {}", code, reason); | ||
} | ||
|
||
pub fn is_running(&self) -> bool { | ||
self.running.load(Ordering::Relaxed) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The running tracker only tracks the exit code now, so maybe it could be renamed or replaced by variable. But I left that for future refactoring. |
||
|
||
pub fn exit_code(&self) -> i32 { | ||
self.exit_code.load(Ordering::Relaxed) | ||
self.exit_code.load(Ordering::Acquire) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add this message back. I thought it wasn't important, but it's actually, the message printed in this bug for example: