New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sane headless operation #103
Comments
Isn't the crontab issue really a shell script issue? Also, we have to remember Windows. |
We need to look at the history of this issue before we do anything. This has come up annually or so since the dawn of ack. |
No.
Since neither crontab nor /dev/TTY appear on windows, I agree the fix to headless shouldn't break windows. if whatever code is forcing it to |
I'm talking about the TTY detection, not libs. |
Agree, review of history is a good thing.
In the rest of the *nix infrastructure, if one expects to read STDIN pipe despite listing files on CLI, one includes |
How is TTY detection a shell thing? |
Why does rm nohup.txt
/usr/bin/nohup ack --type=csv automotive CC*.csv &
sleep 5
cat nohup.txt looks fine. Apparently |
History.Ack1 (all CLOSED)
Ack2
Ack3
|
All I can tell you is that there have been problems with filter vs. direct detection in shell scripts. I don't know more specifics. |
every other code I've seen that takes input from both listed files or STDIN, (a) does the filter DWIM based on if there are excess @argv or not, (b) accepted Are we being too smart where others succeed by trusting the arguments? |
I just ran into this issue in Gitlab CI. Assuming problems related to "interactiveness", I switched to grep and it worked. Trying to understand why, I searched the man page for I used I agree that explicitly giving ARGV path to scan should trump STDIN. This doesn't need to affect ack's output, only its input (any TTY detection doesn't need to be touched). If changing this behavior is not an option, ack could at least:
For reference, here's a small test that shows the different behaviors using docker: $ cat poop.sh
#!/usr/bin/env sh
apk add --update --no-cache ack file;
file /proc/self/fd/0
ack -f
$ BLABLA="--rm -w /src -v $(pwd):/src alpine:latest ./poop.sh"
$ docker run $BLABLA | grep proc
/proc/self/fd/0: symbolic link to /dev/null
$ docker run -i $BLABLA | grep proc
/proc/self/fd/0: symbolic link to pipe:[12640013]
ack: No regular expression found.
$ docker run -t $BLABLA | grep proc
/proc/self/fd/0: symbolic link to /dev/pts/0
$ docker run -it $BLABLA | grep proc
/proc/self/fd/0: symbolic link to /dev/pts/0 |
re FAQ and --nofilter on beyondgrep/ack2#649 -- I agree this is an ack2 FAQ candidate.
but for ack3, I think we should make it work headless: explicit file(s) or directory(s) in
@ARGV
is sufficient user intent that they aren't intending to offer a pipe on STDIN (and they can say-
if they intend to mix files and pipes), so I maintain least surprise is forack
incrontab
to work same as on commandline.--nofilter
doesn't sound like--work-in-crontab
, hardly intuitive. At this point in 3.0, we aren't tied to not-breaking, so we can do the right thing. A better error and a better FAQ isn't much help when there's no TTY, it may be hard to see STDERR. Sayinguse grep for non-interactive
isn't good enough. We're beyond-grep in multiple ways for non-interactive, non-highlight uses.ack --type=$whatever $badword $dir && handle_errors()
is not unreasonable and may be much simpler than equivalentgrep
if$whatever
is complex.The text was updated successfully, but these errors were encountered: