branch: externals/dtache
commit 19f13e25d567861c386e9d33da3ff10539103834
Author: Niklas Eklund <[email protected]>
Commit: Niklas Eklund <[email protected]>
new-dtache-env
---
dtache-env | 21 ++++++++++++++++-----
dtache.el | 5 +++--
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dtache-env b/dtache-env
index 27726c2540..18011e8f07 100755
--- a/dtache-env
+++ b/dtache-env
@@ -1,9 +1,20 @@
#!/usr/bin/env bash
-dtache_command="$*"
+mode="$1"
+shift
+dtache_command="$@"
-if eval "$dtache_command"; then
- echo -e "\nDtache session finished"
-else
- echo -e "\nDtache session exited abnormally with code $?"
+if [ "$mode" = "dumb" ]; 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
+ TERM="eterm-color"
+ if eval script --quiet -f -e -c "\"$dtache_command\"" /dev/null; then
+ echo -e "\nDtache session finished"
+ else
+ echo -e "\nDtache session exited abnormally with code $?"
+ fi
fi
diff --git a/dtache.el b/dtache.el
index 802eee6538..9483e7f424 100644
--- a/dtache.el
+++ b/dtache.el
@@ -1125,8 +1125,9 @@ If SESSION is nonattachable fallback to a command that
doesn't rely on tee."
(format "&> %s" log)))
(env (if dtache-env dtache-env (format "%s -c" dtache-shell-program)))
(command
- (shell-quote-argument
- (dtache--session-command session))))
+ (if dtache-env
+ (concat "smart " (shell-quote-argument (dtache--session-command
session)))
+ (shell-quote-argument (dtache--session-command session)))))
(format "%s %s %s; %s %s" begin-shell-group env command end-shell-group
redirect)))
(defun dtache--host ()