[cfe-commits] [clang-tools-extra] r171994 - /clang-tools-extra/trunk/clang-format/clang-format-diff.py

Kim Gräsman kim.grasman at gmail.com
Thu Jan 10 11:20:02 PST 2013


On Thu, Jan 10, 2013 at 1:04 AM, Matt Beaumont-Gay <matthewbg at google.com> wrote:
>> +
>> +  offset, length = getOffsetLength(filename, line_number, line_count)
>> +  with open(filename, 'r') as f:
>> +    text = f.read()
>> +  p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length),
>> +                        '-style', style],
>> +                       stdout=subprocess.PIPE, stderr=subprocess.PIPE,
>> +                       stdin=subprocess.PIPE)
>> +  stdout, stderr = p.communicate(input=text)
>> +  if stderr:
>> +    print stderr
>
> print >>sys.stderr, stderr
>
> Or just hook up the subprocess's stderr to our stderr?

There's the risk of deadlock that speaks against that:
http://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait

This might be a Windows-only problem, but it's no fun to debug, trust me :-)

- Kim



More information about the cfe-commits mailing list