X-Git-Url: https://git.gir.st/forkaftergrep.git/blobdiff_plain/4f83e12dd2c7b8a87a67159ce9861b4e6d3ee23d..9505a99fd48d04dfd61cac0d77078395b91365e7:/README.md diff --git a/README.md b/README.md index afb351a..9791ba5 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,9 @@ SYNOPSIS fag [OPTIONS] PATTERN PROGRAM [ARGUMENTS...] DESCRIPTION - fag searches the PROGRAM for the string PATTERN. This is useful if a - program takes a while to initialize and prints a message to stdout or - stderr when ready. When placed in a script, fag blocks execution until - the pattern was found, then daemonizes the child process, returns the - PID on stdout and exits. + fag uses grep to search the output of PROGRAM for the regular + expression PATTERN and daemonizes it when a match is found. The PID is + then returned on stdout. OPTIONS Behaviour Changing Options @@ -27,6 +25,9 @@ OPTIONS -e Search PATTERN on stderr instead of stdout. + -V Be verbose; print program's stdout (or stderr if -e is set) to + stderr. + Generic Program Information -h Output a short usage message and exit. @@ -34,20 +35,15 @@ OPTIONS EXIT STATUS If PATTERN was found, 0 is returned. Otherwise, the exit status follows - the BSD guideline outlined in #include if the error - occured from within fag or in case the chid process exits prematurely, + the BSD guideline outlined in #include if the error + occured from within fag or in case the chid process exits prematurely, its exit code is inherited. Notably, 69 is returned when the timeout is reached. BUGS Known Bugs - Only a simple string search is performed on PATTERN in this version. - - If a PROGRAM like cat opens stdout/stderr, but never writes to it, the - timeout isn't triggered. - - SIGNAL needs to be given as an integer; mnemonic should be supported in - the future. + if grep exits with a code > 0, fag should terminate with grep's exit + code and an error message. instead, fag exits as if a match was found. Sometimes, stdin behaves strange after the program terminates. @@ -56,15 +52,19 @@ BUGS https://github.com/girst/forkaftergrep/. NOTES - Some might find the name of this program offensive. Feel free to create - a symlink or alias on your system. + SIGNAL needs to be given as an integer. implementing mnemonics is dirty + and not very portable; maybe support in the future. COPYRIGHT - Copyright 2017 Tobias Girstmair. This is free software; see + Copyright 2017 Tobias Girstmair. This is free software; see https://www.gnu.org/licenses/gpl-3.0.html for conditions. AUTHOR Tobias Girstmair (http://isticktoit.net) -1.0 07 February 2017 fag(1) +1.0 12 August 2017 fag(1) ``` + +## Notes + +I've written this program for the [`tzap`/`szap`](https://linuxtv.org/wiki/index.php/Zap) utilities. They take a few seconds until the TV card/stick is tuned, and won't fork off when they are ready (If you terminate them, the tuning will end). Instead of waiting a few seconds, and hoping for the best, this does the exactly right thing.