Mercurial > ~astiob > upreckon > hgweb
comparison upreckon-vcs @ 138:517dd43f06f8
Upreckon now properly reports exiting due to SIGINT to the calling process
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Tue, 24 May 2011 21:33:32 +0100 |
parents | 796eb7667fb0 |
children | dfde0f5e0984 |
comparison
equal
deleted
inserted
replaced
137:f4361d557929 | 138:517dd43f06f8 |
---|---|
128 | 128 |
129 if ntasks != 1: | 129 if ntasks != 1: |
130 say() | 130 say() |
131 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) | 131 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) |
132 except KeyboardInterrupt: | 132 except KeyboardInterrupt: |
133 sys.exit('Exiting due to a keyboard interrupt.') | 133 say('Exiting due to a keyboard interrupt.', end='', file=sys.stderr) |
134 try: | |
135 import os, signal | |
136 signal.signal(signal.SIGINT, signal.SIG_DFL) | |
137 os.kill(os.getpid(), signal.SIGINT) | |
138 except Exception: | |
139 pass | |
140 # Do this even if we got no exceptions, just in case | |
141 say(file=sys.stderr) | |
142 sys.exit(1) | |
134 | 143 |
135 if options.pause: | 144 if options.pause: |
136 say('Press any key to exit...') | 145 say('Press any key to exit...') |
137 sys.stdout.flush() | 146 sys.stdout.flush() |
138 | 147 |