mirror of https://github.com/jarun/nnn.git
Fix broken GUI cmd run as plugin case
This commit is contained in:
parent
f3e0f23718
commit
046d676a73
1
nnn.1
1
nnn.1
|
@ -401,6 +401,7 @@ separated by \fI;\fR:
|
||||||
export NNN_PLUG='y:-!sync*'
|
export NNN_PLUG='y:-!sync*'
|
||||||
|
|
||||||
5. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR
|
5. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR
|
||||||
|
Note: $nnn must be the last argument in this case.
|
||||||
|
|
||||||
export NNN_PLUG='m:-!&mousepad $nnn'
|
export NNN_PLUG='m:-!&mousepad $nnn'
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,8 @@ To run a GUI app as plugin, add a `&` after `!`.
|
||||||
export NNN_PLUG='m:-!&mousepad $nnn'
|
export NNN_PLUG='m:-!&mousepad $nnn'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: $nnn must be the last argument in this case.
|
||||||
|
|
||||||
#### Page non-interactive command output
|
#### Page non-interactive command output
|
||||||
|
|
||||||
To show the output of run-and-exit commands which do not need user input, add `|` (pipe) after `!`.
|
To show the output of run-and-exit commands which do not need user input, add `|` (pipe) after `!`.
|
||||||
|
|
16
src/nnn.c
16
src/nnn.c
|
@ -5108,7 +5108,7 @@ static void setexports(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool run_cmd_as_plugin(const char *file, uchar_t flags)
|
static bool run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -5122,8 +5122,14 @@ static bool run_cmd_as_plugin(const char *file, uchar_t flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & F_PAGE)
|
if (flags & F_PAGE)
|
||||||
get_output(utils[UTIL_SH_EXEC], g_buf, NULL, -1, TRUE, TRUE);
|
get_output(g_buf, NULL, NULL, -1, TRUE, TRUE);
|
||||||
else
|
else if (flags & F_NOTRACE) {
|
||||||
|
if (is_suffix(g_buf, " $nnn"))
|
||||||
|
g_buf[len - 5] = '\0';
|
||||||
|
else
|
||||||
|
runfile = NULL;
|
||||||
|
spawn(g_buf, runfile, NULL, NULL, flags);
|
||||||
|
} else
|
||||||
spawn(utils[UTIL_SH_EXEC], g_buf, NULL, NULL, flags);
|
spawn(utils[UTIL_SH_EXEC], g_buf, NULL, NULL, flags);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -5257,7 +5263,7 @@ static bool run_plugin(char **path, const char *file, char *runfile, char **last
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((flags & F_NOTRACE) || (flags & F_PAGE))
|
if ((flags & F_NOTRACE) || (flags & F_PAGE))
|
||||||
return run_cmd_as_plugin(file, flags);
|
return run_cmd_as_plugin(file, runfile, flags);
|
||||||
|
|
||||||
cmd_as_plugin = TRUE;
|
cmd_as_plugin = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -5291,7 +5297,7 @@ static bool run_plugin(char **path, const char *file, char *runfile, char **last
|
||||||
} else
|
} else
|
||||||
spawn(g_buf, NULL, *path, sel, 0);
|
spawn(g_buf, NULL, *path, sel, 0);
|
||||||
} else
|
} else
|
||||||
run_cmd_as_plugin(file, flags);
|
run_cmd_as_plugin(file, NULL, flags);
|
||||||
|
|
||||||
close(wfd);
|
close(wfd);
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
|
|
Loading…
Reference in New Issue