[英]Fabric: syntax error near unexpected token '('
我有这样的fabfile.py:
from fabric.api import *
def deploy():
with prefix('source venv/bin/activate'):
local('pex -r <(cat requirements.txt) . -o app.pex')
当我运行$ fab deploy
我得到:
$ fab deploy
[localhost] local: pex -r <(cat requirements.txt) . -o app.pex
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex'
Fatal error: local() encountered an error (return code 1) while executing 'pex -r <(cat requirements.txt) . -o app.pex'
Aborting.
命令source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex
source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex
在shell中运行正常。 我是Fabric的新手。 怎么了
默认情况下, fabric.operations.local()
函数使用/bin/sh
作为外壳程序来运行命令。 这个基本的shell不支持/bin/bash
所支持的所有语法。
如果必须访问Bash shell语法,则设置shell='/bin/bash'
:
local('pex -r <(cat requirements.txt) . -o app.pex', shell='/bin/bash'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.