-o option does not write to log files

Issue #24 new
repo owner created an issue

When using -o option (to show output on the stdout), nothing is written to the log files. It would be good to have the log files written with or without -o.

Comments (3)

  1. Stephan Creutz


    Whenever the option -o is given a utils.Tee object is created instead of a plain file object and is given to subprocess.Popen as follows:

    t = utils.Tee(...)
    subprocess.Popen(..., stdout=t, stderr=t)

    Popen expects that t is a file like object and therefore provides a fileno method which returns a file handle (it doesn't care about a write method). An utils.Tee object provides a fileno method which returns sys.stdout.fileno(). That's why output is only written to stdout.

  2. Stephan Creutz

    One propasal is to use:

    t = utils.Tee(...)
    p = subprocess.Popen(..., stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdoutdata, stderrdata = p.communicate()

    But that solution can lead to deadlocks when the output data is large (more than 64k, the size of a pipe buffer, on Linux) [1] [2].

    We should be careful. ;-)

  3. Log in to comment