projects
/
rrq
/
newlisp-ftw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
59004c2
)
pass EDITOR through sudo
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Thu, 9 Jun 2022 03:51:00 +0000
(13:51 +1000)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Thu, 9 Jun 2022 03:51:00 +0000
(13:51 +1000)
enitool.lsp
patch
|
blob
|
history
diff --git
a/enitool.lsp
b/enitool.lsp
index 21508a9e6e3c23339f09b02c9e02088976ad7ca8..af06741200aa4a374ef61b474b1e0f6446ffbbd0 100755
(executable)
--- a/
enitool.lsp
+++ b/
enitool.lsp
@@
-11,12
+11,13
@@
# right-arrow or return = follow to sourced file, or edit the current block
# left-arrow or q = go up or exit
# right-arrow or return = follow to sourced file, or edit the current block
# left-arrow or q = go up or exit
-
;
(signal 2 (fn (x) (exit)))
+(signal 2 (fn (x) (exit)))
(when (!= "0" (if (exec "id -u") ($it 0) ""))
(when (!= "0" (if (exec "id -u") ($it 0) ""))
- (let ((SUDO (if (exec "command -v sudo") ($it 0) "/usr/bin/sudo")))
- (wait-pid (process (join (cons SUDO (main-args) " ")))))
- (exit 0))
+ (let ((SUDO (if (exec "command -v sudo") ($it 0) "/usr/bin/sudo"))
+ (ED (format "env EDITOR=%s" (or (env "EDITOR") "nano"))) )
+ (wait-pid (process (join (flat (list SUDO ED (main-args))) " ")))
+ (exit 0)))
(constant
;; all "block starters", including blank lines
(constant
;; all "block starters", including blank lines