Show More
@@ -525,9 +525,10 b' class _requesthandler(SocketServer.Strea' | |||||
525 | os.setpgid(0, 0) |
|
525 | os.setpgid(0, 0) | |
526 | ui = self.server.ui |
|
526 | ui = self.server.ui | |
527 | repo = self.server.repo |
|
527 | repo = self.server.repo | |
528 | sv = chgcmdserver(ui, repo, self.rfile, self.wfile, self.connection, |
|
528 | sv = None | |
529 | self.server.hashstate, self.server.baseaddress) |
|
|||
530 | try: |
|
529 | try: | |
|
530 | sv = chgcmdserver(ui, repo, self.rfile, self.wfile, self.connection, | |||
|
531 | self.server.hashstate, self.server.baseaddress) | |||
531 | try: |
|
532 | try: | |
532 | sv.serve() |
|
533 | sv.serve() | |
533 | # handle exceptions that may be raised by command server. most of |
|
534 | # handle exceptions that may be raised by command server. most of | |
@@ -544,7 +545,11 b' class _requesthandler(SocketServer.Strea' | |||||
544 | except: # re-raises |
|
545 | except: # re-raises | |
545 | # also write traceback to error channel. otherwise client cannot |
|
546 | # also write traceback to error channel. otherwise client cannot | |
546 | # see it because it is written to server's stderr by default. |
|
547 | # see it because it is written to server's stderr by default. | |
547 | traceback.print_exc(file=sv.cerr) |
|
548 | if sv: | |
|
549 | cerr = sv.cerr | |||
|
550 | else: | |||
|
551 | cerr = commandserver.channeledoutput(self.wfile, 'e') | |||
|
552 | traceback.print_exc(file=cerr) | |||
548 | raise |
|
553 | raise | |
549 |
|
554 | |||
550 | def _tempaddress(address): |
|
555 | def _tempaddress(address): |
@@ -338,8 +338,9 b' class _requesthandler(SocketServer.Strea' | |||||
338 | def handle(self): |
|
338 | def handle(self): | |
339 | ui = self.server.ui |
|
339 | ui = self.server.ui | |
340 | repo = self.server.repo |
|
340 | repo = self.server.repo | |
341 | sv = server(ui, repo, self.rfile, self.wfile) |
|
341 | sv = None | |
342 | try: |
|
342 | try: | |
|
343 | sv = server(ui, repo, self.rfile, self.wfile) | |||
343 | try: |
|
344 | try: | |
344 | sv.serve() |
|
345 | sv.serve() | |
345 | # handle exceptions that may be raised by command server. most of |
|
346 | # handle exceptions that may be raised by command server. most of | |
@@ -354,7 +355,11 b' class _requesthandler(SocketServer.Strea' | |||||
354 | except: # re-raises |
|
355 | except: # re-raises | |
355 | # also write traceback to error channel. otherwise client cannot |
|
356 | # also write traceback to error channel. otherwise client cannot | |
356 | # see it because it is written to server's stderr by default. |
|
357 | # see it because it is written to server's stderr by default. | |
357 | traceback.print_exc(file=sv.cerr) |
|
358 | if sv: | |
|
359 | cerr = sv.cerr | |||
|
360 | else: | |||
|
361 | cerr = channeledoutput(self.wfile, 'e') | |||
|
362 | traceback.print_exc(file=cerr) | |||
358 | raise |
|
363 | raise | |
359 |
|
364 | |||
360 | class unixservice(object): |
|
365 | class unixservice(object): |
@@ -717,6 +717,35 b' unix domain socket:' | |||||
717 | listening at .hg/server.sock |
|
717 | listening at .hg/server.sock | |
718 | abort: unknown command unknowncommand |
|
718 | abort: unknown command unknowncommand | |
719 | killed! |
|
719 | killed! | |
|
720 | $ rm .hg/server.log | |||
|
721 | ||||
|
722 | if server crashed before hello, traceback will be sent to 'e' channel as | |||
|
723 | last ditch: | |||
|
724 | ||||
|
725 | $ cat <<EOF >> .hg/hgrc | |||
|
726 | > [cmdserver] | |||
|
727 | > log = inexistent/path.log | |||
|
728 | > EOF | |||
|
729 | >>> from hgclient import unixserver, readchannel, check | |||
|
730 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') | |||
|
731 | >>> def earlycrash(conn): | |||
|
732 | ... while True: | |||
|
733 | ... try: | |||
|
734 | ... ch, data = readchannel(conn) | |||
|
735 | ... if not data.startswith(' '): | |||
|
736 | ... print '%c, %r' % (ch, data) | |||
|
737 | ... except EOFError: | |||
|
738 | ... break | |||
|
739 | >>> check(earlycrash, server.connect) | |||
|
740 | e, 'Traceback (most recent call last):\n' | |||
|
741 | e, "IOError: *" (glob) | |||
|
742 | >>> server.shutdown() | |||
|
743 | ||||
|
744 | $ cat .hg/server.log | grep -v '^ ' | |||
|
745 | listening at .hg/server.sock | |||
|
746 | Traceback (most recent call last): | |||
|
747 | IOError: * (glob) | |||
|
748 | killed! | |||
720 | #endif |
|
749 | #endif | |
721 | #if no-unix-socket |
|
750 | #if no-unix-socket | |
722 |
|
751 |
General Comments 0
You need to be logged in to leave comments.
Login now