![]() ![]() Oh and “output is unbuffered” makes me very happy in retrospect, as again buffering output bit me several times as I worked on this. The command ls -1 | tee foo.txt will list files in a directory and create foo.txt with the contents as well. It’s named metaphorically for a T-shaped pipe fitting. When I think of intercepting a stream I think of the tee command, which, according to the manpage “…copies standard input to standard output, making a copy in zero or more files. My mundane dream was to see the entire output flow by in a terminal while being alerted only for certain text, when my attention wanders. $ ruby -e 'STDOUT.sync=true while(true) puts Time.now sleep 1 end' | cat Testingįirst, I needed input to test with so I decided to go with a Ruby one-liner: I had to deal with that ( STDOUT.sync=true, -line-buffered) several times. My biggest takeaway: commands tend to buffer output when used in a pipeline, because they’re optimizing for completing the processing of finite input but not for interactively processing a stream. Again, you learn a few things when you try to do something new with the tools available. I searched the web, skimmed manpages, and fumbled around enjoying the process. ![]() Putting this together was an interesting way to spend an hour. ![]() Filtering those out is left as an exercise for some day.) Scratching an Itch (Yes, I see the [32m in the notification that’s the terminal escape codes for color highlighting. Anyway, I’ve added teeshout to my bash config and we’ll see how often I use it in the coming weeks. Clicking while keeping my eye on the logging was a pain. Originally, I wanted this while tail-ing a running logfile and interacting with a web app, hoping to trigger certain events. Web_1 | Laravel development server started on Web_1 | Generating optimized class loader $ docker-compose up | teeshout "Laravel development server started on"Ĭreating network "dockerize_internal" with driver "bridge" ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |