[MERGE] get rid of os.spawnvp() usage for external diff

John Arbash Meinel john at arbash-meinel.com
Sat Jun 17 01:36:11 BST 2006


Aaron Bentley wrote:

> 
> Diff I meant.  Are you handling the case where diff is not installed?

There is a try/catch checking for OSError, e.errno == errno.ENOENT.

The test is skipped in that case.
Do you need the external_code to handle it specifically.

> 
>>> Bonus points if you pass in -b, because that's more similar to
>>> internal_diff's output.
>>
>> I thought '-b' would mean that it doesn't create a diff hunk for
>> whitespace. 
> 
> Sorry,  --binary.

I would be up for that. It does nothing on posix platforms, but is very 
important for windows. Should we always be setting this flag, or just in 
the test suite?

> 
>> Popen() doesn't support them, so you can't pass them as stdout for the
>> spawned command.
>> You could create another temporary file, and then read in the output,
>> and write it to the passed in file.
> 
> It's easier than that:
> p = Popen(stdout=PIPE)
> to_file.writelines(p.stdout.readlines())
> 
>> But why not let other people worry about that.
> 
> Sure.
> 
> Aaron

The problem is if the output is larger than say 8K, then this would 
block. I think you would need to do:

p = Popen(stdout=PIPE)
out, err = p.communicate()
to_file.write(out)

Though I'm not positive.

John
=:->




More information about the bazaar mailing list