redding/scmd — pull request #18 by kellyredding (2013-10-16 20:11:58+00:00)
Title: read output from stdout and stderr while cmd is running

This updates the cmd to begin reading from stdout and stderr as
soon as the cmd has started running. This is accomplished by
starting a thread that reads `READ_SIZE` bytes from the io as long
as the cmd is running. Data is read using `read_nonblock` and new
data is detected using `IO.select`.

As before, calling `wait` if the cmd was started asynchronously
is highly recommended (this either waits for the cmd to finish or
times out). Either way, this ensures the read output thread is
exited and the exitstatus captured. This is handled automatically
if the cmd is started synchronously using `run`.

The goal here is to prevent "deadlock" scenarios where a cmd can't
finish b/c it has filled up one of the output streams. It also
enables output "streaming" as output will now be available for
inspecting as soon as it is written.

Finally, this switches to _not_ stripping any read output. This is
necessary b/c we are now streaming output but also good b/c we want
to preserve the output exactly as the cmd produced it.

@jcredding ready for review.