python-3.x - 带有 pexpect 的 sshfs 没有报告错误但无法挂载(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])
...
推荐阅读
- arduino - ESP8266 WiFiUDP 发送数据包导致挂起然后崩溃
- angular - 通过表单控件从父级获取验证器
- stackexchange-api - SEDE 中的结果计数与 Stack Exchange 的 API 不匹配
- python - 如何在不结束python中的for循环的情况下使用return?
- ios - 使用圆形按钮自定义标签栏问题 swift
- php - 检查元素是否存在于数组中,如果条件 PHP 则返回
- javascript - 让机器人对自己的消息做出反应
- shell - 以表格格式排列数据
- android - Facebook 受众网络广告(奖励、横幅、插页式广告)未在发布模式下显示
- codeigniter - CI 4项目公用文件夹内的NULL文件夹