]] Joey Hess | Tollef Fog Heen wrote: | > cgrep(1) is a tool to grep the output of a command, and if we find the | > text we're looking for (or find any text we're not looking for, when | > running with -v), we output the full stdout and stderr and exit with the | > same status as the running process. | | I wonder if cgrep is a memorable enough name. The menomic for the 'c' is | weak. Actually, putting it in the grep family may be the problem I sense | with the name. It doesn't do grep-style output filtering, quite. | | Moreutils has ifne(1) which checks if standard input is not empty before | running a command. So a corresponding name might be 'ifemit'. | | ifemit 'foo bar' mycommand | | Hmm, that name doesn't say what it does with the output, but it does | sort of suggest it looks at more than just stdout, and seems easier | to remember than cgrep to me.
I'm happy for it to be named ifemit or ifoutputcontains or something like that. Btw, the -v mode is currently broken or weird, I'll see if I can come up with a fix for that. | > This is using IPC::Run, it's much, much simpler to do it using IPC::Run | > than IPC::Popen3. (In fact, it's so much easier that if I were to use | > IPC::Open3, I'd probably just write it in C instead.) | | I suppose what IPC::Run gives you is a non-blocking select loop. I | respect not wanting to write *that* again. :) Indeed, it just gives me the output in scalars I can do regexes on instead of having to select and add to the output scalars. There's a limitation in the current version in that the output must fit comfortably in memory, but I don't really consider that a problem as it's rare for you to have cron mails that go on for many mega- or gigabytes. -- Tollef Fog Heen UNIX is user friendly, it's just picky about who its friends are -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org