-
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
[macOS] neovide process disown from terminal? #402
Comments
a quick way to do that is to put the following code in #[cfg(not(debug_assertions))]
if std::env::args().find(|f| f == "--disown").is_some() {
if let Ok(curr_exe) = std::env::current_exe() {
assert!(std::process::Command::new(curr_exe)
.args(std::env::args().skip(1).filter(|f| f != "--disown"))
.spawn()
.is_ok());
std::process::exit(0);
}
else {
eprintln!("error in disowning process, cannot obtain the path for the current executable, continuing without disowning...");
}
} and then build with |
This looks good to me. Feel free to make a pull request. I have been a bit tied up recently, but I can merge the changes this weekend. |
Consider to make this |
Yeah I agree. On mac machines we should just do this by default. On windows this is the normal behavior. Not sure about linux |
okay, so to do that the modified code is #[cfg(not(debug_assertions))]
if std::env::args().find(|f| f == "--disowned").is_none() {
if let Ok(curr_exe) = std::env::current_exe() {
assert!(std::process::Command::new(curr_exe)
.args(std::env::args().skip(1))
.arg("--disowned")
.spawn()
.is_ok());
std::process::exit(0);
} else {
eprintln!("error in disowning process, cannot obtain the path for the current executable, continuing without disowning...");
}
} file -> fn new() -> Self {
let mut log_to_file = false;
let neovim_arguments = std::env::args()
.filter(|arg| {
if arg == "--log" {
log_to_file = true;
false
} else if arg == "--version" || arg == "-v" {
println!("Neovide version: {}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
} else if arg == "--help" || arg == "-h" {
println!("neovide : {}", env!("CARGO_PKG_DESCRIPTION"));
std::process::exit(0);
} else if arg == "--disowned" {
false
} else {
!(arg.starts_with("--geometry=") || arg == "--wsl")
}
})
.collect::<Vec<String>>();
#[cfg(not(test))]
Settings::init_logger(log_to_file);
Self {
neovim_arguments,
settings: RwLock::new(HashMap::new()),
listeners: RwLock::new(HashMap::new()),
readers: RwLock::new(HashMap::new()),
}
} |
@tarunzoot looks not bad from a cursory glance. Could you make a PR? |
@Kethku @tarunzoot looks like this was merged #411. Is it done? |
Correct |
Thanks. |
I'm new to neovide. When I build neovide with
cargo build --release
, and running it (ie../target/release/neovide
) from the shell (terminal), it does not disown with the terminal. The neovide spawned the window, but the command in shell does not return until neovide terminate. Meaning closing the terminal window (or Ctrl-C) also closes the neovide window.For now I have to define a shell function like this:
So that when I type
nvim foo.txt
and closing the terminal tab does not closing the window of enovide too.Maybe we need a script like mvim in MacVim?
The text was updated successfully, but these errors were encountered: