ctdb-build: Move internal include files in a separate directory
[samba.git] / selftest / in_screen
index 927d83109bde5447269c33a03b43c673991e9689..5468a216e310fb7c2c2cc27804f97252fac37486 100755 (executable)
@@ -39,6 +39,7 @@ printenv |
   sed "s/\(^[^=]*=\)\(.*\)/export \1'\2'/g" > $basedir/$SERVERNAME.vars
 
 cat <<EOF > $basedir/$SERVERNAME.launch
+cd $PWD
  echo \$\$ > $basedir/$SERVERNAME.pid
  . $basedir/$SERVERNAME.vars
  echo "\$(date) starting $SERVERNAME" >> $basedir/$SERVERNAME.log
@@ -68,7 +69,11 @@ cleanup() {
 rm -f $basedir/$SERVERNAME.status $basedir/$SERVERNAME.log
 echo $$ > $basedir/$SERVERNAME.parent.pid
 trap cleanup SIGINT SIGTERM SIGPIPE
-screen -r -X screen -t test:$SERVERNAME bash $basedir/$SERVERNAME.launch
+if [[ "$TMUX" ]]; then
+    tmux new-window -n test:$SERVERNAME "bash $basedir/$SERVERNAME.launch"
+else
+    screen -r -X screen -t test:$SERVERNAME bash $basedir/$SERVERNAME.launch
+fi
 echo "$(date) waiting in $$" >> $basedir/$SERVERNAME.log
 read stdin_var
 echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log