Patchwork sshpeer: forward stdout of remote "hg init" to appropriate output channel

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 14, 2014, 1:53 p.m.
Message ID <cc4be0f3d54ce2cdbfe6.1413294838@mimosa>
Download mbox | patch
Permalink /patch/6247/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 14, 2014, 1:53 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1413291579 -32400
#      Tue Oct 14 21:59:39 2014 +0900
# Node ID cc4be0f3d54ce2cdbfe6d6c8bc25de74d07b437c
# Parent  75d0edb68b417964110e3fcd69187c867f31a119
sshpeer: forward stdout of remote "hg init" to appropriate output channel

Otherwise, commandserver channel could be corrupted.
Augie Fackler - Oct. 14, 2014, 7:42 p.m.
On Tue, Oct 14, 2014 at 10:53:58PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1413291579 -32400
> #      Tue Oct 14 21:59:39 2014 +0900
> # Node ID cc4be0f3d54ce2cdbfe6d6c8bc25de74d07b437c
> # Parent  75d0edb68b417964110e3fcd69187c867f31a119
> sshpeer: forward stdout of remote "hg init" to appropriate output channel

Seems reasonable.

>
> Otherwise, commandserver channel could be corrupted.

This makes me wonder if we should make out be a required param for util.system.

>
> diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
> --- a/mercurial/sshpeer.py
> +++ b/mercurial/sshpeer.py
> @@ -52,7 +52,7 @@ class sshpeer(wireproto.wirepeer):
>                  util.shellquote("%s init %s" %
>                      (_serverquote(remotecmd), _serverquote(self.path))))
>              ui.debug('running %s\n' % cmd)
> -            res = util.system(cmd)
> +            res = util.system(cmd, out=ui.fout)
>              if res != 0:
>                  self._abort(error.RepoError(_("could not create remote repo")))
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Siddharth Agarwal - Oct. 14, 2014, 7:48 p.m.
On 10/14/2014 12:42 PM, Augie Fackler wrote:
>> Otherwise, commandserver channel could be corrupted.
> This makes me wonder if we should make out be a required param for util.system.

It might actually be worth making the ui object own command execution. 
ui.system(...) or similar.
Augie Fackler - Oct. 14, 2014, 7:49 p.m.
On Oct 14, 2014, at 3:48 PM, Siddharth Agarwal <sid@less-broken.com> wrote:

> On 10/14/2014 12:42 PM, Augie Fackler wrote:
>>> Otherwise, commandserver channel could be corrupted.
>> This makes me wonder if we should make out be a required param for util.system.
> 
> It might actually be worth making the ui object own command execution. ui.system(...) or similar.

Not a bad thought. I've queued this patch in any case (I think I forgot to mention that.)

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Yuya Nishihara - Oct. 15, 2014, 2:53 p.m.
On Tue, 14 Oct 2014 15:49:49 -0400, Augie Fackler wrote:
> 
> On Oct 14, 2014, at 3:48 PM, Siddharth Agarwal <sid@less-broken.com> wrote:
> 
> > On 10/14/2014 12:42 PM, Augie Fackler wrote:
> >>> Otherwise, commandserver channel could be corrupted.
> >> This makes me wonder if we should make out be a required param for util.system.
> > 
> > It might actually be worth making the ui object own command execution. ui.system(...) or similar.
> 
> Not a bad thought. I've queued this patch in any case (I think I forgot to mention that.)

Sounds nice. I'll try it.

Thanks,

Patch

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -52,7 +52,7 @@  class sshpeer(wireproto.wirepeer):
                 util.shellquote("%s init %s" %
                     (_serverquote(remotecmd), _serverquote(self.path))))
             ui.debug('running %s\n' % cmd)
-            res = util.system(cmd)
+            res = util.system(cmd, out=ui.fout)
             if res != 0:
                 self._abort(error.RepoError(_("could not create remote repo")))