diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -15,6 +15,9 @@ import time from .i18n import _ +from .thirdparty import ( + cbor, +) from . import ( encoding, error, @@ -155,8 +158,8 @@ def workerfunc(): os.close(rfd) - for i, item in func(*(staticargs + (pargs,))): - os.write(wfd, '%d %s\n' % (i, item)) + for result in func(*(staticargs + (pargs,))): + os.write(wfd, cbor.dumps(result)) return 0 ret = scmutil.callcatch(ui, workerfunc) @@ -187,9 +190,15 @@ os.kill(os.getpid(), -status) sys.exit(status) try: - for line in util.iterfile(fp): - l = line.split(' ', 1) - yield int(l[0]), l[1][:-1] + while True: + try: + yield cbor.load(fp) + except EOFError: + break + except IOError as e: + if e.errno == errno.EINTR: + continue + raise except: # re-raises killworkers() cleanup()