From fac88e1501f588ad647d7630a1df8309c210f665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BF=D0=B8=D1=80=D0=B8=D0=B4=D0=BE=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=94=D0=B5=D0=BD=D0=B8=D1=81?= Date: Thu, 21 Jun 2012 12:27:01 +0400 Subject: [PATCH] fix stop wait_thread --- console/application/cl_client.py | 3 +-- scripts/cl-console | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/console/application/cl_client.py b/console/application/cl_client.py index 643a865..0eb1a45 100644 --- a/console/application/cl_client.py +++ b/console/application/cl_client.py @@ -279,10 +279,9 @@ def https_server(client, args, unknown_args, url, clVarsCore, wait_thread): wait_thread.stop() return 0 -def main(): +def main(wait_thread): parser = parse() args, unknown_args = parser.parse_known_args() - wait_thread = StoppableThread() wait_thread.start() if not args.method and args.help: wait_thread.stop() diff --git a/scripts/cl-console b/scripts/cl-console index 75b92b4..c53fdfc 100755 --- a/scripts/cl-console +++ b/scripts/cl-console @@ -16,7 +16,7 @@ # limitations under the License. import sys -from calculate.console.application.cl_client import main +from calculate.console.application.cl_client import main, StoppableThread from calculate.console.application.function import _print reload(sys) sys.setdefaultencoding("utf-8") @@ -28,8 +28,10 @@ setLocalTranslate('calculate_console',sys.modules[__name__]) if __name__=='__main__': __builtin__.__dict__['_print'] = _print try: - sys.exit(main()) + wait_thread = StoppableThread() + sys.exit(main(wait_thread)) except KeyboardInterrupt: + wait_thread.stop() red = '\033[31m * \033[0m' print '\n'+red+_('Interrupted by user') sys.exit(1) \ No newline at end of file