Browse code

Merge pull request #132 from cloudbuilders/tmux

add support for tmux if USE_TMUX=yes

sleepsonthefloor authored on 2011/11/16 03:54:56
Showing 1 changed files
... ...
@@ -958,12 +958,17 @@ fi
958 958
 function screen_it {
959 959
     NL=`echo -ne '\015'`
960 960
     if [[ "$ENABLED_SERVICES" =~ "$1" ]]; then
961
-        screen -S stack -X screen -t $1
962
-        # sleep to allow bash to be ready to be send the command - we are
963
-        # creating a new window in screen and then sends characters, so if
964
-        # bash isn't running by the time we send the command, nothing happens
965
-        sleep 1
966
-        screen -S stack -p $1 -X stuff "$2$NL"
961
+        if [[ "$USE_TMUX" =~ "yes" ]]; then
962
+            tmux new-window -t stack -a -n "$1" "bash"
963
+            tmux send-keys "$2" C-M
964
+        else
965
+            screen -S stack -X screen -t $1
966
+            # sleep to allow bash to be ready to be send the command - we are
967
+            # creating a new window in screen and then sends characters, so if
968
+            # bash isn't running by the time we send the command, nothing happens
969
+            sleep 1
970
+            screen -S stack -p $1 -X stuff "$2$NL"
971
+        fi
967 972
     fi
968 973
 }
969 974