Reputation: 578
I have the issue with Fabric which doesn't allow me to execute two run commands.
I have a task for Fabric
@task
def deploy():
run("su - user")
run("cd /home/user/project")
and when I run a function with fab deploy
script connect to a server and run only first line
[34.252.47.139] run: su - user
[34.252.47.139] out: [email protected] [~]#
On this step I terminate console with Ctrl+D
key and after it I see that second line of code executes.
So the total output in console is:
[34.252.47.139] run: su - user
[34.252.47.139] out: [email protected] [~]# logout (Here I terminate a console)
[34.252.47.139] out:
[34.252.47.139] run: cd /home/user/project
Done.
Disconnecting from 34.***.***.***... done.
Upvotes: 0
Views: 89
Reputation: 2448
Consider using sudo()
and cd()
context manager instead. Something like:
@task
def deploy():
with cd('/home/user/project'):
sudo('your-command', user=user)
Upvotes: 1