Martin Pool wrote:
2009/4/25 Chris Johns <ch...@contemporary.net.au>:
If I may move the topic back to "bash scripting" from "language bashing" ..
;)
I find shell scripting handles some tasks better than say Python. I would
rather use Python for these tasks but have not found a suitable solution. I
need to build large packages and capture the output sometimes via tee. This
output is often never less 100M and more often over 250M. How could I have
Python start the build and capture the output to disk ?
Capturing to memory in Python is not an viable option and I have looked at
threads that capture the output but this is more programming than scripting.
I see the problem I have as a scripting task not a programming one.
Look at the examples in
http://docs.python.org/library/subprocess.html#replacing-shell-pipeline
This is what I am after. Thanks for the reference. It is a nice piece of
documentation.
If you just want to capture it to disk, just pass a file object as
stdout. If you (by tee) want to also scan through it, then provide a
pipe which you'll read from.
Most of the time I do not need to "tee".
If you want to simultaneously but separately scan both stdout and
stderr, you inherently have a concurrent programming issue, and it
will be slightly more complicated, but not much.
Not really.
Regards
Chris
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders