Strangely the tail of unixes has diverted. OSX tail does not have
support for "--" or long args. But the same functionality is hidden
under short args.
`--follow=name`, `--lines=` and `--retry` is not supported by OSX tail.
- `--lines=` is replaced by the short alternative `-n`
> -n, --lines=[+]NUM
> output the last NUM lines, instead of the last 10; or use
> -n +NUM to output starting with line NUM
>
> tail(1) — Linux manual page
- `--follow=name` and `--retry` by `-F`
> -F same as --follow=name --retry
>
> tail(1) — Linux manual page
There is some trade off regarding descriptiveness but OSX support
seams preferable - OSX user
Tested on linux as well so I don't belive this will break on linux.
---
detached.el | 8 ++++----
test/detached-test.el | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/detached.el b/detached.el
index b878ea6..73c3eee 100644
--- a/detached.el
+++ b/detached.el
@@ -919,8 +919,8 @@ Optionally CONCAT the command return command into a string."
Optionally CONCAT the command return command into a string."
(detached-connection-local-variables
(let* ((log (detached--session-file session 'log t))
- (tail-command `(,detached-tail-program "--follow=name" "--retry"
- ,(concat "--lines="
detached-session-context-lines)
+ (tail-command `(,detached-tail-program "-F"
+ ,(concat "-n "
detached-session-context-lines)
,log)))
(cond ((eq 'create detached-session-mode)
(detached--dtach-command session))
@@ -957,7 +957,7 @@ Optionally CONCAT the command return command into a string."
(if concat
(string-join
`(,(when detached-show-session-context
- (format "%s --lines=%s %s;" detached-tail-program
detached-session-context-lines log))
+ (format "%s -n %s %s;" detached-tail-program
detached-session-context-lines log))
,detached-dtach-program
,dtach-arg
,socket
@@ -965,7 +965,7 @@ Optionally CONCAT the command return command into a string."
" ")
(append
(when detached-show-session-context
- `(,detached-tail-program ,(format "--lines=%s"
detached-session-context-lines)
+ `(,detached-tail-program ,(format "-n %s"
detached-session-context-lines)
,(concat log ";")))
`(,detached-dtach-program ,dtach-arg ,socket "-r" "none")))
(if concat
diff --git a/test/detached-test.el b/test/detached-test.el
index 513eb72..b53c02c 100644
--- a/test/detached-test.el
+++ b/test/detached-test.el
@@ -96,11 +96,11 @@
(let* ((detached-session-mode 'attach)
(log (detached--session-file session 'log t))
(expected `(,detached-tail-program
- ,(format "--lines=%s" detached-session-context-lines)
+ ,(format "-n %s" detached-session-context-lines)
,(format "%s;" log)
,detached-dtach-program "-a"
,(detached--session-file session 'socket t) "-r" "none"))
(expected-concat (format "%s %s; %s -a %s -r none"
- (format "%s --lines=%s"
detached-tail-program detached-session-context-lines)
+ (format "%s -n %s"
detached-tail-program detached-session-context-lines)
log
detached-dtach-program
(detached--session-file session
'socket t))))
--
2.30.1 (Apple Git-130)