Mercurial > public > mercurial-scm > hg
diff mercurial/debugcommands.py @ 36843:31581528f242
debugwireproto: close the write end before consuming all available data
And make it read all available data deterministically. Otherwise util.poll()
may deadlock because both stdout and stderr could have no data.
Spotted by the next patch which removes stderr from the fds.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 12 Mar 2018 22:47:33 +0900 |
parents | 5bc7ff103081 |
children | c92d1d3c58ee |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Fri Mar 09 15:57:16 2018 +0100 +++ b/mercurial/debugcommands.py Mon Mar 12 22:47:33 2018 +0900 @@ -2690,7 +2690,8 @@ readavailable ------------- - Read all available data from the server. + Close the write end of the connection and read all available data from + the server. If the connection to the server encompasses multiple pipes, we poll both pipes and read available data. @@ -2835,17 +2836,9 @@ elif action == 'close': peer.close() elif action == 'readavailable': - fds = [stdout.fileno(), stderr.fileno()] - try: - act = util.poll(fds) - except NotImplementedError: - # non supported yet case, assume all have data. - act = fds - - if stdout.fileno() in act: - util.readpipe(stdout) - if stderr.fileno() in act: - util.readpipe(stderr) + stdin.close() + stdout.read() + stderr.read() elif action == 'readline': stdout.readline() else: