branch: externals/dtache commit 2764a299891e65f4c16704034a99fd85fdf59bcd Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Update dtache-env-mode --- dtache-env | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dtache-env b/dtache-env index 0ff7f879b5..2427d3a342 100755 --- a/dtache-env +++ b/dtache-env @@ -1,18 +1,28 @@ #!/usr/bin/env bash +# dtache-env is a script which purpose is to run a dtache command, and +# issue to stdout, based on the exit code. + mode="$1" shift dtache_command="$*" -if [ "$mode" = "dumb" ]; then +# dtache-env features two different modes: +# 1) Plain-text: where plain text data will be logged in the sessions output +# 2) Terminal-data: the script command is used to record the terminal +# data in raw format, this includes ansi escape sequences. The TERM +# environmental variable is set to eterm-color in order to enabled +# colored outputs from the dtache_command + +if [ "$mode" = "plain-text" ]; then if eval "$dtache_command"; then echo -e "\nDtache session finished" else echo -e "\nDtache session exited abnormally with code $?" fi -elif [ "$mode" = "smart" ]; then +elif [ "$mode" = "terminal-data" ]; then TERM="eterm-color" - if eval script --quiet -f -e -c "\"$dtache_command\"" /dev/null; then + if eval script --quiet --flush --return --command "\"$dtache_command\"" /dev/null; then echo -e "\nDtache session finished" else echo -e "\nDtache session exited abnormally with code $?"