On Mon, Mar 18, 2013 at 3:43 PM, Ulf Larsson <[email protected]>wrote:

> > Date: Thu, 14 Mar 2013 10:06:15 -0500
> > Subject: Re: [thg] svn and git subrepos on windows
> > From: [email protected]
> > To: [email protected]
> > CC: [email protected]
> >
> >
> >
> >
> > On Thu, Mar 14, 2013 at 12:02 AM, Ulf Larsson
> > <[email protected]<mailto:[email protected]>> wrote:
> >
> > Hi all,
> >
> > When doing update (or clone) with svn or git subrepos on windows,
> > tortoisehg aborts with an 'the handle is invalid' error.
> >
> > This has been reported as https://bitbucket.org/tortoisehg/thg/issue/484
> >
> > I think the problem is that subprocess.Popen is used in the mercurial
> code
> > to call the command line tools for svn and git. But subprocess.Popen
> > does not work well with pythonw as reported in
> > http://bugs.python.org/issue3905.
> >
> > When using pythonw sys.stdin is not valid but still != None. Adding the
> > following line to the thg main script:
> >
> > if sys.stdin and sys.stdin.fileno() < 0:
> >      sys.stdin = None
> >
> > makes tortoisehg update of svn subrepos work on windows. Is this an
> > acceptable fix for tortoisehg?
> >
> >
> > I believe that pythonw in python3 has sys.stdin == None.
> >
> > Thanks for digging into this. I looked for a more reliable check and
> found:
> >
> >
> http://www.velocityreviews.com/forums/t729325-re-windows-how-to-detect-whether-a-python-app-script-is-runningin-console-gui-mode.html
> >
> > And have now pushed this:
> >
> >
> https://bitbucket.org/tortoisehg/thg/commits/dd1848441aa82a192cf8bc23adbbad9c4dd81b60
> >
> > Can you verify this works as you expect?
> >
> > --
> > Steve Borho
>
>
> No, it is still not working. When testing now, I see that I was wrong in my
> previous post. Setting
> sys.stdin = None
> in thg main script does not help. subprocess.Popen uses
> _subprocess.GetStdHandle(_subprocess.STD_INPUT_HANDLE)
> to get stdin. Changing sys.stdin does not help. Sorry for the confusion.
>
> To fix this, one probably needs to modify mercurial.subrepos such that
> subprocess.Popen is called with keyword argument stdin=subprocess.PIPE.
> The attached patch tries to do that.
>

The patch looks plausible, but it will need to get reviewed on the
mercurial-devel mailing list before it can be pushed.  Be aware they prefer
the patch to be presented in the body (and not attached) of the email for
ready review.

Thanks for following through.

-- 
Steve Borho
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Tortoisehg-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-discuss

Reply via email to