emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/detached 10220f8663 01/22: Move detached-env mode into


From: ELPA Syncer
Subject: [elpa] externals/detached 10220f8663 01/22: Move detached-env mode into detached.el
Date: Mon, 30 May 2022 10:57:29 -0400 (EDT)

branch: externals/detached
commit 10220f8663c57f0868914c6b47f9fa2c765d7b93
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Move detached-env mode into detached.el
    
    We can control the mode inside detached.el instead of starting to
    build up logic in detached-env.
---
 detached-env | 22 +++++++---------------
 detached.el  |  7 ++++---
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/detached-env b/detached-env
index 0db3e69615..b35712662d 100755
--- a/detached-env
+++ b/detached-env
@@ -3,8 +3,8 @@
 # detached-env is a script which purpose is to run a detached command, and
 # issue to stdout, based on the exit code.
 
-mode="$1"
-shift
+# mode="$1"
+# shift
 detached_command="$*"
 
 # detached-env features two different modes:
@@ -14,17 +14,9 @@ detached_command="$*"
 #    environmental variable is set to eterm-color in order to enabled
 #    colored outputs from the detached_command
 
-if [ "$mode" = "plain-text" ]; then
-    if eval "$detached_command"; then
-        echo -e "\nDetached session finished"
-    else
-        echo -e "\nDetached session exited abnormally with code $?"
-    fi
-elif [ "$mode" = "terminal-data" ]; then
-    TERM="eterm-color"
-    if eval script --quiet --flush --return --command "\"$detached_command\"" 
/dev/null; then
-        echo -e "\nDetached session finished"
-    else
-        echo -e "\nDetached session exited abnormally with code $?"
-    fi
+TERM="eterm-color"
+if eval "$detached_command"; then
+    echo -e "\nDetached session finished"
+else
+    echo -e "\nDetached session exited abnormally with code $?"
 fi
diff --git a/detached.el b/detached.el
index f712898e1a..5f108bf197 100644
--- a/detached.el
+++ b/detached.el
@@ -1173,9 +1173,10 @@ If SESSION is nonattachable fallback to a command that 
doesn't rely on tee."
             (format "&> %s" log)))
          (env (if detached-env detached-env (format "%s -c" 
detached-shell-program)))
          (command
-          (if detached-env
-              (concat (format "%s " (detached--session-env-mode session))
-                      (shell-quote-argument (detached--session-command 
session)))
+          (if (eq 'terminal-data (detached--session-env-mode session))
+              (shell-quote-argument
+               (format "script --quiet --flush --return --command \"%s\" 
/dev/null"
+                       (detached--session-command session)))
             (shell-quote-argument (detached--session-command session)))))
     (format "%s %s %s; %s %s" begin-shell-group env command end-shell-group 
redirect)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]