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

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

[elpa] externals/detached 70ebb9488f: Implement automatic detection of t


From: ELPA Syncer
Subject: [elpa] externals/detached 70ebb9488f: Implement automatic detection of terminal data command
Date: Fri, 1 Jul 2022 09:57:35 -0400 (EDT)

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

    Implement automatic detection of terminal data command
    
    Use the operating system to deduce the command to use for
    script. Users can however override it manually.
---
 CHANGELOG.org |  1 +
 detached.el   | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index ccafaaadca..88e01d074a 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -3,6 +3,7 @@
 #+language: en
 
 * Development
+- Detached tries to guess the =detached-terimal-data-command= based on 
operating system, if that's not possible the user needs to set it manually. 
Currently detection of =gnu/linux= and =darwin= is supported.
 - Detached now relies on the tool =tail= in order to attach to degraded 
sessions. That means that =dtach= and =tail= are required to properly use the 
package.
 - Rename non-attachable sessions to degraded sessions.
 - Remove tail command, favor using =attach= or =view=.
diff --git a/detached.el b/detached.el
index 88ce93aaf9..1d10d879e3 100644
--- a/detached.el
+++ b/detached.el
@@ -92,8 +92,10 @@
   :type 'boolean
   :group 'detached)
 
-(defcustom detached-terminal-data-command "script --quiet --flush --return 
--command \"%s\" /dev/null"
-  "The command for the tool script, which is used to record terminal data."
+(defcustom detached-terminal-data-command nil
+  "The command for the tool script, which is used to record terminal data.
+If the variable is not set, the command is the deduced by `detached'
+based on the `system-type'."
   :type 'string
   :group 'detached)
 
@@ -1232,8 +1234,14 @@ If SESSION is degraded fallback to a command that 
doesn't rely on tee."
            (format "if %s; then true; else echo \"[detached-exit-code: $?]\"; 
fi"
                    (if (eq 'terminal-data (detached--session-env session))
                        (format "TERM=eterm-color %s"
-                               (format detached-terminal-data-command
-                                       (detached--session-command session)))
+                               (format
+                                (or
+                                 detached-terminal-data-command
+                                 (pcase system-type
+                                   ('gnu/linux "script --quiet --flush 
--return --command \"%s\" /dev/null")
+                                   ('darwin "script -F -q /dev/null %s")
+                                   (_ (error "Unable to determine script 
command, set `detached-terminal-data-command'"))))
+                                (detached--session-command session)))
                      (detached--session-command session))))))
     (format "%s %s %s; %s %s" begin-shell-group shell command end-shell-group 
redirect)))
 



reply via email to

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