Skip to content
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:! Don't fork by default #2512

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/cmd_line.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{iter, mem};

use crate::utils::is_tty;
use crate::{dimensions::Dimensions, frame::Frame, settings::*};

use anyhow::Result;
Expand All @@ -24,14 +23,6 @@ fn get_styles() -> Styles {
.placeholder(styling::AnsiColor::Cyan.on_default())
}

fn is_tty_str() -> &'static str {
if is_tty() {
"1"
} else {
"0"
}
}

#[derive(Clone, Debug, Parser)]
#[command(version, about, long_about = None, styles = get_styles())]
pub struct CmdLineSettings {
Expand Down Expand Up @@ -77,7 +68,7 @@ pub struct CmdLineSettings {
pub title_hidden: bool,

/// Spawn a child process and leak it [DEFAULT]
#[arg(long = "fork", env = "NEOVIDE_FORK", action = ArgAction::SetTrue, default_value = is_tty_str(), value_parser = FalseyValueParser::new())]
#[arg(long = "fork", env = "NEOVIDE_FORK", action = ArgAction::SetTrue, default_value = "0", value_parser = FalseyValueParser::new())]
pub fork: bool,

/// Be "blocking" and let the shell persist as parent process. Takes precedence over `--fork`.
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ fn maybe_disown() {

let settings = SETTINGS.get::<CmdLineSettings>();

if cfg!(debug_assertions) || !settings.fork {
// Never fork unless a tty is attached
if !settings.fork || !utils::is_tty() {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions website/docs/command-line-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ This disables neovim's multigrid functionality which will also disable floating
backgrounds, smooth scrolling, and window animations. This can solve some issues where neovide
acts differently from terminal neovim.

### No Fork
### Fork

```sh
--no-fork or $NEOVIDE_FORK=0|1
--fork or $NEOVIDE_FORK=0|1
```

By default, neovide detaches itself from the terminal. Instead of spawning a child process and
leaking it, be "blocking" and have the shell directly as parent process.
Detach from the terminal instead of waiting for the Neovide process to
terminate. This parameter has no effect when launching from a GUI.

### No Idle

Expand Down
Loading