mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Fix #459
The following changes are made: - STDOUT and STDIN are redirected to /dev/null when spawning rclone rclone blocks and also shows error/warning messages. nnn needs to spawn rclone and return without waiting. To avoid the rclone messages from corrupting the screen nnn makes the child silent. Note: sshfs returns after mount with a proper error code - prompt only if both sshfs and rclone are installed
This commit is contained in:
parent
c7e2dc0005
commit
27943b9efb
25
src/nnn.c
25
src/nnn.c
|
@ -3580,14 +3580,26 @@ static bool archive_mount(char *name, char *path, char *newpath, int *presel)
|
||||||
static bool remote_mount(char *newpath, int *presel)
|
static bool remote_mount(char *newpath, int *presel)
|
||||||
{
|
{
|
||||||
uchar flag = F_CLI;
|
uchar flag = F_CLI;
|
||||||
int r, opt = get_input(messages[MSG_REMOTE_OPTS]);
|
int opt;
|
||||||
char *tmp, *env, *cmd;
|
char *tmp, *env, *cmd;
|
||||||
|
bool r, s;
|
||||||
|
|
||||||
|
r = getutil(utils[UTIL_RCLONE]);
|
||||||
|
s = getutil(utils[UTIL_SSHFS]);
|
||||||
|
|
||||||
|
if (!(r || s))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (r && s)
|
||||||
|
opt = get_input(messages[MSG_REMOTE_OPTS]);
|
||||||
|
else
|
||||||
|
opt = (!s) ? 'r' : 's';
|
||||||
|
|
||||||
if (opt == 's') {
|
if (opt == 's') {
|
||||||
cmd = utils[UTIL_SSHFS];
|
cmd = utils[UTIL_SSHFS];
|
||||||
env = xgetenv("NNN_SSHFS", cmd);
|
env = xgetenv("NNN_SSHFS", cmd);
|
||||||
} else if (opt == 'r') {
|
} else if (opt == 'r') {
|
||||||
flag |= F_NOWAIT;
|
flag |= F_NOWAIT | F_NOTRACE;
|
||||||
cmd = utils[UTIL_RCLONE];
|
cmd = utils[UTIL_RCLONE];
|
||||||
env = xgetenv("NNN_RCLONE", "rclone mount");
|
env = xgetenv("NNN_RCLONE", "rclone mount");
|
||||||
} else {
|
} else {
|
||||||
|
@ -3612,10 +3624,11 @@ static bool remote_mount(char *newpath, int *presel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert "Host" to "Host:" */
|
/* Convert "Host" to "Host:" */
|
||||||
r = strlen(tmp);
|
size_t len = strlen(tmp);
|
||||||
if (tmp[r - 1] != ':') { /* Append ':' if missing */
|
|
||||||
tmp[r] = ':';
|
if (tmp[len - 1] != ':') { /* Append ':' if missing */
|
||||||
tmp[r + 1] = '\0';
|
tmp[len] = ':';
|
||||||
|
tmp[len + 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect to remote */
|
/* Connect to remote */
|
||||||
|
|
Loading…
Reference in a new issue