• Duncan Coutts's avatar
    Report process output decoding errors in context · cc35a48a
    Duncan Coutts authored
    It turns out that in rawSystemStdInOut any IO errors, including text
    decoding, occurring while collecting the output (stderr or stdout) do
    not get reported immediately, but only later if/when the output is
    consumed. This is because the exceptions happened in the threads forked
    to force the output, but if the main thread looks at the output later
    then the exception is reported again.
    This leads to very confusing results. In particular we had a case where
    the configure process did not fail until writing out the LocalBuildInfo
    because that was the first point that forced the output. So the distance
    from when the exception really occurred and the fact that the exception
    message does not include the name of the program run means that this is
    then a pain to track down.
    This patch makes sure that any exceptions arising from forcing the
    program output occur immediately and with an error message that includes
    the name of the program in question.