Browse code

Use C-M for return carriage for tmux.

Conflicts:

stack.sh

Chmouel Boudjnah authored on 2011/11/03 02:27:40
Showing 1 changed files
... ...
@@ -915,12 +915,17 @@ fi
915 915
 function screen_it {
916 916
     NL=`echo -ne '\015'`
917 917
     if [[ "$ENABLED_SERVICES" =~ "$1" ]]; then
918
-        screen -S stack -X screen -t $1
919
-        # sleep to allow bash to be ready to be send the command - we are
920
-        # creating a new window in screen and then sends characters, so if
921
-        # bash isn't running by the time we send the command, nothing happens
922
-        sleep 1
923
-        screen -S stack -p $1 -X stuff "$2$NL"
918
+        if [[ "$USE_TMUX" =~ "yes" ]]; then
919
+            tmux new-window -t stack -a -n "$1" "bash"
920
+            tmux send-keys "$2" C-M
921
+        else
922
+            screen -S stack -X screen -t $1
923
+            # sleep to allow bash to be ready to be send the command - we are
924
+            # creating a new window in screen and then sends characters, so if
925
+            # bash isn't running by the time we send the command, nothing happens
926
+            sleep 1
927
+            screen -S stack -p $1 -X stuff "$2$NL"
928
+        fi
924 929
     fi
925 930
 }
926 931