python Fabric不允许我将输出通过管道传输到less?
我是第一次设置 Fabric,但在将 Fabric 的输出传输到 less 时遇到了麻烦。例如,如果我运行:(
fabric deploy |less
其中,deploy 是我的部署函数)
我会从 Fabric 收到以下错误:
IOError: [Errno 22] Invalid argument
This comes from a run()
command on the Remote Host。
如果我将 pty=False
添加到 run()
参数中,它就会起作用。然而,这意味着每个运行命令,我都需要添加这个参数。更不用说,我相信它对提示和输入数据有影响(显然对于这些情况我不会减少)。
我该如何解决这个问题?我应该对所有事情都执行 tty=false
吗?
I'm setting up fabric for the first time, and having trouble piping the output from fabric to less. For example, if I run:
fabric deploy |less
(Where deploy is my deployment function)
I get the following error back from fabric:
IOError: [Errno 22] Invalid argument
This comes from a run()
command on the remote host.
If I add pty=False
to the run()
arguments, it works. However, that means every run command, I need to add this argument. Not to mention, I believe it has implications with prompts and entering data (obviously for those cases I won't be piping to less).
How can I fix this? Should I just do tty=false
for everything?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅供将来参考,我通过对 Operations.py 应用补丁解决了这个问题,如下所示:
http://code.fabfile.org/attachments/56/operations.patch
否则,重现此问题的代码如下:
如果执行以下命令,则会出现此问题:
希望这对某人有帮助...我仍然不明白为什么这么旧的错误仍然没有在最新版本的 Fabric 中得到修复。
-达斯汀
Just for future reference, I resolved this by applying a patch to operations.py, as seen here:
http://code.fabfile.org/attachments/56/operations.patch
Otherwise, the code that would reproduce this problem is as follows:
And the issue would come up if you did the following command:
Hope this helps someone... I still don't understand why a bug this old still hasn't been patched in the latest release of fabric.
-Dustin