带有 pexpect 的 sshfs 报告没有错误但无法挂载 (Python 3)
sshfs with pexpect reported no error but failed to mount (Python 3)
我求助!
command = "sshfs " + username + "@" + host + ":" + hostdirectory \
+ " " + mountpoint + " -o nonempty "
sshfs = pexpect.spawn(command)
sshfs.expect(username + "@" + host + "'s password: ")
time.sleep(1)
sshfs.sendline(password)
time.sleep(10)
sshfs.expect(pexpect.EOF)
运行无误,但 /home/user/Mnt/
为空。我 运行 Linux Mint 20.1.
上的代码
sshfs
早该被SIGHUP
杀死了。
尝试像这样忽略 SIGHUP
:
command = "sshfs " + ...
pexpect.spawn('bash', args=['-c', "trap '' HUP; " + command])
...
通过关键字参数 ignore_sighup=True
忽略 SIGHUP
信号的效果相同。它在后台保持 sshfs
运行。
sshfs = pexpect.spawn(command, ignore_sighup=True)
我求助!
command = "sshfs " + username + "@" + host + ":" + hostdirectory \
+ " " + mountpoint + " -o nonempty "
sshfs = pexpect.spawn(command)
sshfs.expect(username + "@" + host + "'s password: ")
time.sleep(1)
sshfs.sendline(password)
time.sleep(10)
sshfs.expect(pexpect.EOF)
运行无误,但 /home/user/Mnt/
为空。我 运行 Linux Mint 20.1.
sshfs
早该被SIGHUP
杀死了。
尝试像这样忽略 SIGHUP
:
command = "sshfs " + ...
pexpect.spawn('bash', args=['-c', "trap '' HUP; " + command])
...
通过关键字参数 ignore_sighup=True
忽略 SIGHUP
信号的效果相同。它在后台保持 sshfs
运行。
sshfs = pexpect.spawn(command, ignore_sighup=True)