Pipe Sphinx Doc build results to text file

I wanted to pipe the results of the Sphinx Doc build into a text file so that I could address any errors or warnings. I started with this (I’m using Windows 8.1):

c:pathtodocroot>make html > log.txt

When I opened the file, there were no errors or warnings listed – and it wasn’t because I’m fabulous.

It turns out that there are two output streams: STDOUT (Standard Out) and STDERR (Standard Error). The example above only redirects STDOUT to file. In order to redirect both streams, you need to do this:

c:pathtodocroot>make html > log.txt 2>&1

To write only the warnings and errors to a file, you can do this:

c:pathtodocroot>make html 2> log.txt

Note: This is not specific to Sphinx Doc; that is just the context in which I learned about STDOUT and STDERR.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s