pressly / sup

Super simple deployment tool - think of it like 'make' for a network of servers
https://pressly.github.io/sup
MIT License
2.48k stars 178 forks source link

Do sequential commands run in different sessions? #106

Closed basharov closed 6 years ago

basharov commented 7 years ago

I am trying out sup and here is my Supfile

networks:
    staging:
      hosts:
        - root@myhost

commands:
    lsroot:
      desc: list root
      run: cd /; ls
    goroot:
      desc: go to root path
      run: cd /
    ls:
      desc: list files
      run: ls

When I run sup staging lsroot, it goes to root path / then lists the tree correctly. But when I run sup staging goroot ls, it seems like two commands run in their own sessions, because ls shows content of /root folder, not /.

Is it an intentional behavior? I'd like to run a list of commands in one session., like in lsroot example above.

VojtechVitek commented 7 years ago

@basharov Thanks for the question. Yes, this is intentional behavior. If you want to do sequential command within the same session, your approach with lsroot is correct (run: cd /; ls).

Thinking of it, we might introduce a $SUP_PWD variable or similar, if there's enough demand.

VojtechVitek commented 6 years ago

Very useful syntax for running multiple commands in a single session:

build:
   run: |
     echo "multiline"
     echo "input"
     if [ "$SUP_NETWORK" == "build" ]; then
        docker build #...
     fi