mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
revert to pipe - behaves better
This commit is contained in:
@ -137,6 +137,16 @@ done
|
|||||||
# is returned and not of colouring pipe.
|
# is returned and not of colouring pipe.
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# Define function to colour output by argument 1
|
||||||
|
colourPipe(){
|
||||||
|
if [ "$1" ]; then
|
||||||
|
(while read line; do setterm -foreground $1; echo "$line" ; done; setterm -foreground default)
|
||||||
|
else
|
||||||
|
cat
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
colourIndex=0
|
colourIndex=0
|
||||||
|
|
||||||
while :
|
while :
|
||||||
@ -156,14 +166,14 @@ do
|
|||||||
if lockfile -r0 "$lockFile" 2>/dev/null; then
|
if lockfile -r0 "$lockFile" 2>/dev/null; then
|
||||||
if [ "$WM_COLOURS" ]; then
|
if [ "$WM_COLOURS" ]; then
|
||||||
# Set colour
|
# Set colour
|
||||||
colourString=`setterm -foreground ${colours[$colourIndex]}`
|
colour="${colours[$colourIndex]}"
|
||||||
|
|
||||||
if [ "$host" = "$HOST" ]; then
|
if [ "$host" = "$HOST" ]; then
|
||||||
eval $* 2>&1 | sed -e "s/^/$colourString/"
|
eval $* 2>&1 | colourPipe "$colour"
|
||||||
elif [ -n "$JOB_ID" ]; then
|
elif [ -n "$JOB_ID" ]; then
|
||||||
qrsh -inherit -v PWD $host "$rcmd"
|
qrsh -inherit -v PWD $host "$rcmd"
|
||||||
else
|
else
|
||||||
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | sed -e "s/^/$colourString/"
|
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour"
|
||||||
fi
|
fi
|
||||||
retval=$?
|
retval=$?
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user