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

Daniel Jasper djasper at google.com
Thu Jan 10 11:31:37 PST 2013


We used to not do any formatting when stderr was non-empty. Now with Alex's
error reporting, this changes, but we still want to capture stderr and
print a single-line error, so that the vim does not shuffle around or
flash..


On Thu, Jan 10, 2013 at 8:20 PM, Kim Gräsman <kim.grasman at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130110/e8d9a6f5/attachment.html>


More information about the cfe-commits mailing list