README.md | 10 ---------- nnn.1 | 5 ----- nnn.c | 14 ++++++++------ diff --git a/README.md b/README.md index f05893959480258414c697c4ffc62d0075555a98..36b15ea02cc286614a5a66a57c2b2b6c48ac15a0 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,6 @@ - [file copy, move, delete](#file-copy-move-delete) - [boost chdir prompt](#boost-chdir-prompt) - [set idle timeout](#set-idle-timeout) - [show hot plugged drives](#show-hot-plugged-drives) -- [Troubleshooting](#troubleshooting) - - [nnn blocks on opening files](#nnn-blocks-on-opening-files) - [Why fork?](#why-fork) - [Mentions](#mentions) - [Developers](#developers) @@ -452,14 +450,6 @@ #### show hot plugged drives Enable volume management in your DE file manager and set removable drives or media to be auto-mounted when inserted. Then visit the usual mount point location (`/mnt` or `/media/user`) in `nnn`. - -### Troubleshooting - -#### nnn blocks on opening files - -Ideally nnn should not block. Unfortunately, sometimes even the same desktop opener behaves differently on different Linux desktop environments. If `nnn` does block when a file is open, set the environment variable `NNN_NOWAIT` to any non-zero value. For example, - - export NNN_NOWAIT=1 ### Why fork? diff --git a/nnn.1 b/nnn.1 index 389620008dbb4bd3177c1720127e30b3c48be456..92245a6959e13865a5a390325526e66cc722ac8d 100644 --- a/nnn.1 +++ b/nnn.1 @@ -253,11 +253,6 @@ .Bd -literal export NNN_NO_X=1 .Ed .Pp -\fBNNN_NOWAIT:\fR necessary only if nnn blocks while a file is open. -.Bd -literal - export NNN_NOWAIT=1 -.Ed -.Pp \fBNNN_QUOTE_ON:\fR wrap copied paths within single quotes. Useful for pasting names in the shell. .Sh KNOWN ISSUES diff --git a/nnn.c b/nnn.c index 389a63a1e50d6602562c8bbe5ed74f1938a4a39d..d5d544cdd0cd31040f89f8df4ffad0c153bf9a6a 100644 --- a/nnn.c +++ b/nnn.c @@ -248,7 +248,6 @@ static char *player; static char *copier; static char *editor; static char *desktop_manager; -static char nowait = F_NOTRACE; static blkcnt_t ent_blocks; static blkcnt_t dir_blocks; static ulong num_files; @@ -757,6 +756,12 @@ dup2(fd, 1); dup2(fd, 2); close(fd); + } + + if (flag & F_NOWAIT) { + signal(SIGHUP, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + setsid(); } if (flag & F_SIGINT) @@ -2520,7 +2525,7 @@ } } /* Invoke desktop opener as last resort */ - spawn(utils[OPENER], newpath, NULL, NULL, nowait); + spawn(utils[OPENER], newpath, NULL, NULL, F_NOWAIT | F_NOTRACE); continue; } default: @@ -2878,7 +2883,7 @@ printmsg("set NNN_DE_FILE_MANAGER"); goto nochange; } - spawn(desktop_manager, path, NULL, path, F_NOTRACE | F_NOWAIT); + spawn(desktop_manager, path, NULL, path, F_NOWAIT | F_NOTRACE); break; case SEL_FSIZE: cfg.sizeorder ^= 1; @@ -3340,9 +3345,6 @@ idletimeout = abs(atoi(copier)); /* Get the default copier, if set */ copier = getenv("NNN_COPIER"); - - /* Get nowait flag */ - nowait |= getenv("NNN_NOWAIT") ? F_NOWAIT : 0; /* Enable quotes if opted */ if (getenv("NNN_QUOTE_ON"))