Windows: using hg executable from an IDE results in python errors

Alexander Belchenko bialix at ukr.net
Thu Mar 20 14:48:59 CDT 2008


Steve Borho пишет:
> On Thu, 2008-03-20 at 11:20 -0700, Howard Ha wrote:
>> Hi everyone,
>>
>> I'm completely new to Mercurial, but a longtime cvsnt user considering 
>> moving our entire team to Hg.
>>
>> We do web development on Windows boxes using PHPEd as our IDE, and 
>> luckily that tool has the ability to integrate with external apps by 
>> executing "shell scripts" (they use this to integrate svn and cvs with 
>> the IDE).  The added benefit of using this over just using tortoiseHg is 
>> that we can assign keyboard shortcuts (highly useful) to the actions 
>> that we integrate (push, pull, update, commit, log, etc).
>>
>> I managed to figure out how to create an appropriate shell script 
>> command line for using Mercurial with PHPEd, but the result is a crash 
>> and error dump.  The EXACT SAME command in a windows command prompt 
>> works perfectly fine.
>>
>> The error output is:
>>
>> c:\development\tortoisehg\hg.exe log benchmark_library.inc.php --cwd 
>> E:\projectscvs\beeza\includes\
>> Traceback (most recent call last):   
>> File "hg", line 29, in <module> 
>> File "mercurial\util.pyc", line 992, in set_binary
>> IOError: [Errno 9] Bad file descriptor
>>
>> I'm using the tortoisehg's hg.exe executable, but the same errors 
>> (different line numbers) come up if I use the executables made by Lee 
>> Cantey (http://mercurial.berkwood.com/).
>>
>> Opening up cmd.exe and running:
>>
>> c:\development\tortoisehg\hg.exe log benchmark_library.inc.php --cwd 
>> E:\projectscvs\beeza\includes\
>>
>> Works perfectly.
>>
>> Any ideas what the problem might be and any possible work arounds?  I'm 
>> unsure how PHPEd is executing the script, but I assume there must be 
>> some environment variables missing or something.
>>
>> Any help would be GREATLY appreciated.
> 
> One of the first thing Mercurial does when invoked on Windows is to set
> the binary attribute on STDIN, STDOUT, and STDERR file handles.  This is
> required in order for commands that input/output text to work correctly
> (import, export, diff, etc).
> 
>    msvcrt.setmode(fd.fileno(), os.O_BINARY)
> 
> The file handles provided by PHPEd do not care for this function call at
> all.  I suspect we should be catching the IOError and ignoring it.
> 
> What do you think, Patrick?
> 
I'm not Patrick but you need to test is fd hasattr fileno. When program running as
subprocess then pipes fd never had fileno. Because they're not real files.



More information about the Mercurial mailing list